• 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Search and Pagination - Error

#1
[eluser]Unknown[/eluser]
Hi,
I try to search in my system library system search by author,book name.And i wrote these codes for searching .

Controller
Code:
function searchbyauthor()
    {
        $this->load->view('front/front_searchbyauthor');
    }

    function searchbyauthor_do()
    {
        $this->load->model('front/search_model');
        $data['show'] = $this->search_model->searchbyauthors_do();
        $this->load->view('front\front_searchbyauthorlist',$data);
    }

Model
Code:
<?php
class search_model extends Model {

    var $author_name = ' ';

    function search_model()
    {
        parent::Model();    
        $this->load->helper('date');
    }

    function searchbyauthors_do()
    {
        $this->db->like('author_name', $_POST['author_name'], 'both');
        $query = $this->db->get('authors');
        return $query->result();
    }    

}

View
Code:
&lt;!--[if !IE]>start row<![endif]--&gt;
                                <div class="row">
                                    <label>Auhtor Name :</label>
                                    <div class="inputs">
                                        <span class="input_wrapper">&lt;input class="text" name="author_name" type="text" /&gt;&lt;/span>
                                    </div>
                                </div>
                                &lt;!--[if !IE]>end row<![endif]--&gt;

And button
Code:
<span class="button blue_button search_button"><span><span>Search for Me</span></span>&lt;input name="" type="submit" /&gt;&lt;/span>

It's working correctly but i cant added pagination into that system.How can i add or config search result ll be in pagination page.

Thanks,sorry for English Sad

#2
[eluser]Jondolar[/eluser]
Since clicking on a pagination link will load another page and thus lose your search post, you need to somehow pass the original search string back to the page along with the new page number. You can either store the search string in a session or cookie variable when the original search is made or you can add the search string as a parameter to the url you are navigating to (?search=book). Every one of your pagination links must have this parameter in order for it to work.

#3
[eluser]Unknown[/eluser]
Thanks alot.
It works now =)


Digg   Delicious   Reddit   Facebook   Twitter   StumbleUpon  


  Theme © 2014 iAndrew  
Powered By MyBB, © 2002-2020 MyBB Group.