Welcome Guest, Not a member yet? Register   Sign In
how to manage input->post and uri->segment at the same time for pagination ?
#1

[eluser]ludo31[/eluser]
Hello ,
I need your help for this case , in my view I have a simple select inside a form

Code:
<?php echo form_open(annonce/afficherAnnonce); ?>

<select name="pays">
    
          
            
            <optgroup label="liste">
                <option value="1">france</option>
                  <option value="2">usa</option>
                  <option value="3">israel</option>
                  <option value="4">allemagne</option>
                  <option value="5">chine</option>
                
</optgroup>
</select>

&lt;?php echo form_submit('envoyer', 'envoyer'); ?&gt;

&lt;?php echo form_close();?&gt;

and in my controller I need to catch the value and also to create the pagination

Code:
public  function afficherAnnonce ()
{
// I try to catch the value
      
$pays = $this->input->post('pays');


        // the number of rows and the uri segment for pagination

            
            $offset = $this->uri->segment(3);
            $limit = 4 ;
           $config['base_url']='http://localhost/MonSite/index.php/annonce/afficherAnnonce';
            $config['total_rows']= $this->annoncemodel->getRowAnnonce();
            
            $config['num_links']=5;  
            
            $config['per_page']= $limit;
            
            $config['full_tag_open']='<div id="pagination">';
            
             $config['full_tag_close']='</div>';
            
             $config['next_link']='>>';
            
              $config['prev_link']='<<';
              
              $this->pagination->initialize($config);
              
              
          $data['infos'] = $this->annoncemodel->getAnnonce($config['per_page'],$this->uri->segment(3));
          
          
      
      
      
      
              $this->load->view('principalannonce',$data);

}

but I don't know what's wrong but I can't catch the value correctly and the pagination don't work correctly may there is a conflict between

Code:
$pays = $this->input->post('pays');

and

Code:
$offset = $this->uri->segment(3);

did you have a suggestion please ???

thanks




Theme © iAndrew 2016 - Forum software by © MyBB