Welcome Guest, Not a member yet? Register   Sign In
help : CodeIgniter Search and pagination ?
#1

[eluser]ludo31[/eluser]
Hello ;
I need your help ;

I try to make a simple search with pagination and I have a problem that was discussed here :

http://www.devessence.com/2009/10/11/cod...-segments/

in my view file :

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

     <label for="Province"> Faritra  : </label>
    
    
     <select name="province">
    
            <option value="0">Ataovy ny safidy</option>
            
            <optgroup label="Faritra">
                <option value="1">Antananarivo</option>
                  <option value="2">Antsiranana</option>
                  <option value="3">Fianarantsoa</option>
                  <option value="4">Mahajanga</option>
                  <option value="5">Toamasina</option>
                  <option value="6">Toliara</option>
            </optgroup>
     </select>
    
    
     <label for="Categorie" >Sokajy</label>
    
     <select name="categorie">
    
            <option value="0">Ataovy ny safidy</option>
            
            <optgroup label="Fiara-Moto ">
                <option value="1">Voitures (fiara)</option>
                  <option value="1">Motos</option>
                  <option value="1">Utilitaires (fiasana)</option>
                  <option value="1">Pieces Auto</option>
                  <option value="1">Pieces Moto</option>



                        
            </optgroup>
      
      </select>
   &lt;?php echo form_submit('envoyer', 'Karoy'); ?&gt;
  
   &lt;?php form_close();?&gt;

and in my controller :

Code:
public  function rechercher ()
{
      $province = $this->input->post('province');
      $categorie =  $this->input->post('categorie');
    
      //  $province = 1;
       // $categorie=1;
      
      
        $offset = $this->uri->segment(3);
            $limit = 2 ;
           $config['base_url']='http://localhost/MonSite/index.php/annonce/rechercher';
          
          
            $config['total_rows']= $this->annoncemodel->getRowAnnonceRecherche($province,$categorie);
            
            $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->getAnnonceRecherche($province,$categorie,$config['per_page'],$offset);
              
            
          
           // var_dump($data);exit ;
      
      
      
      
              $this->load->view('principalannonce',$data);
              
              
      
      
      
      
      // $this->annoncemodel->getAnnonceRecherche ($province,$categorie,$limit ,$offset);

}

when I try to run it run and make the research but when I click on page 2 nothing !!

I think the problem is here :

Code:
$province = $this->input->post('province');
  $categorie =  $this->input->post('categorie');
    
      //  $province = 1;
       // $categorie=1;
      
      
        $offset = $this->uri->segment(3);

because when I try to change like that

Code:
//$province = $this->input->post('province');
  //$categorie =  $this->input->post('categorie');
    
        $province = 1;
       $categorie=1;
it works !! may be there is a conflict between uri->segment ans input->post

help me please I try to find a solution !!

thanks


Messages In This Thread
help : CodeIgniter Search and pagination ? - by El Forum - 03-21-2012, 04:10 AM
help : CodeIgniter Search and pagination ? - by El Forum - 03-21-2012, 06:17 AM
help : CodeIgniter Search and pagination ? - by El Forum - 03-21-2012, 08:32 AM
help : CodeIgniter Search and pagination ? - by El Forum - 03-21-2012, 09:43 AM
help : CodeIgniter Search and pagination ? - by El Forum - 03-21-2012, 01:25 PM



Theme © iAndrew 2016 - Forum software by © MyBB