Pagination and _post variable |
[eluser]bianchi[/eluser]
Friends, How can i hold the _post variable on the pagination.. for example : when the search happened.. the keyword (_post) = woody page 2 : i got : http://localhost/perfumeshop/perfumes/search/woody/5 but if i clicked page 2, the url on pagination link lost the woody and will query all of the table... for example page 3 : http://localhost/perfumeshop/perfumes/se...0......the keywords "woody" had gone.. How can I keep the keyword ? so my search result can be paginated well... Thanks my controller : Code: function search(){ Code: function perfumes_search_description($display,$offset,$num) Thank you all
[eluser]mddd[/eluser]
The problem is that you are getting the search word from $_POST. After clicking a link from pagination, the $_POST is no longer there. But the search word IS in the url, after 'search' ! You could check to see if there is a search word in $_POST, and if it is not there, look in $this->uri->segment(3) to see if the word is there!
[eluser]bianchi[/eluser]
i found blank screen when i did this : echo $this->uri->segment(3); what should i do?
[eluser]bianchi[/eluser]
[quote author="bianchi" date="1275313145"]i found blank screen when i did this : echo $this->uri->segment(3); what should i do?[/quote] and I got 0 when i invoked this : echo $this->uri->segment(4,0); what should i change ?
[eluser]mddd[/eluser]
At first, the keyword will be in $_POST and not in the url.. But after you click a link from your pagination, it will be in the url and not in $_POST. Like so: /perfumes/search/searchword/2. So your code could be like: Code: // check if keyword is in $_POST. if not, check the uri.
[eluser]bianchi[/eluser]
it works, thank you very much my friend You can see the result : http://perfumeshop.rickoshop.com/perfume.../Hilton/10 or see the search : http://perfumeshop.rickoshop.com Thanks again... |
Welcome Guest, Not a member yet? Register Sign In |