search and pagination on codeigniter search and pagination on codeigniter codeigniter codeigniter

search and pagination on codeigniter


hi i really like this tutorial of net.tuts about search in CI and its really good you will not need to use sessions for save and retrieving search data, you need to extend your input class and it will save keywords and search criteria in database gives you and id for that saved record which you can use in pagination have look on this really great tutorial

CI search and pagination


If you set session like this away null when hit next page because $data is no data (post is send only one), I think you mush set in condition like that

    $is_search =  $this->input->post('search'); // name button search    if (!array_filter($data) && $is_search===false) { // check array is empty and no search value (only submit form have search name)           $data = array(                 'reason'           => $this->session->userdata('reason'),                 'shahr'            => $this->session->userdata('shahr'),                 'file_type'        => $this->session->userdata('file_type'),                 'region'           => $this->session->userdata('region'),                 'neighbourhood'    => $this->session->userdata('neighbourhood'),                 'under_build_area' => $this->session->userdata('under_build_area'),                 'user_type'        => $this->session->userdata('user_type')           );    } else {           $this->session->set_userdata( $data ); // create new session    }/*-------------------------------------------------------*/    $page = ($this->uri->segment(4)) ? $this->uri->segment(4) : 0;