Save query in pagination |
[eluser]nofearinc[/eluser]
I have a search form that queries few tables and extracts a result set which is paginated. The problem is that when I click on another page, query gets clear (select *) and no search data is applied anymore. My search parameters are not persistent after the first request. How can I save the search criteria when switching through paginated table? P.S. Similar problem without replies: second link doesn't save the query
[eluser]nofearinc[/eluser]
It's 20 parameters from 6 joined tables, but the important part is that I generate query with $_POST parameters and logically they aren't persistent during paging. Code: function sell() {
[eluser]nofearinc[/eluser]
A possible solution is saving input parameters into session and getting them from there every time I use pagination. The problem is when I'm going to flush the session? The best way is repopulating the $_POST every time I click next page, but I'm not sure how can I do request forwarding here. Any ideas?
[eluser]flaky[/eluser]
Have you considered flashdata ? http://ellislab.com/codeigniter/user-gui...sions.html Quote:Flashdata
[eluser]nofearinc[/eluser]
It jumped out of my head, yes. That seems a good workaround of my problem, thanks. Going to test it this night.
[eluser]nofearinc[/eluser]
Flashdata works just fine - before every page I send search parameters via session->set_flashdata(...) and retrieve them on load. One important detail only: If I try to directly use the session->flashdata() elements, I have strange caching for the first page load and it gets OK on refresh. I inspected it with the profiler and parameters haven't been sent to the query at all. Instead of refreshing, I assigned the flashdata() parameters to variables and that thing did the stuff. Thanks for helping! |
Welcome Guest, Not a member yet? Register Sign In |