[Solved]Another Pagination problem |
[eluser]bondjp[/eluser]
Hi guys, i have a problem with pagination. I have a form where the user chooses several parameters using a dropdown box. i can show the results of the form_submit on my 1st pagination page. When selecting "2" i get a blank page. I know that i need to use sessions so that my POST passes to the other pages. My question is how can i do it? I've been searching the forum all day but i didn't found any example that matches my problem. I appreciate if anyone could help me. My code: Home_View Code: <?php Controller Code: $limit=4; Model Code: function searchCars($limit, $offset){ Results_View Code: //Form is available in the results view so users can search other info withou going to home_view
[eluser]Craig300[/eluser]
I came across this problem a few weeks ago and I ended up modifying the core Pagination.php library to use form buttons instead of links so that the search parameters can be posted through instead of using sessions, which is still a valid way of course. By using form buttons, you can pass the search criteria, either singularly or in an array, to the next page in order to perform the search again. Hope this helps ![]()
[eluser]bondjp[/eluser]
[quote author="Craig300" date="1266429428"]I came across this problem a few weeks ago and I ended up modifying the core Pagination.php library to use form buttons instead of links so that the search parameters can be posted through instead of using sessions, which is still a valid way of course. By using form buttons, you can pass the search criteria, either singularly or in an array, to the next page in order to perform the search again. Hope this helps ![]() Thanks. I'm new to codeigniter so this is a bit over the top for me. Do you have any example code i can see to understand how to do it?
[eluser]LuckyFella73[/eluser]
Maybe this thread is helpfull: http://ellislab.com/forums/viewthread/44845/P15/ POST #21 seems to be a quite simple and nice solution.
[eluser]bondjp[/eluser]
Ok. Followed the link and here's what i got. I needed to change db_session to session or i get an error saying it doesn't recognizes db_session. Code: if ($_POST['brand']) { Now i get this error: A PHP Error was encountered Severity: Notice Message: Undefined property: Results::$userdata Filename: controllers/results.php Line Number: 77 Fatal error: Call to a member function searchCars() on a non-object in \controllers\results.php on line 77 How to proceed from here? Thanks
[eluser]bondjp[/eluser]
Success! Lol, managed to get it working like this: Controller Code: if ($this->input->post('brand')) { Model Code: $brand = $this->session->userdata('brands'); Thanks guys. On to the next problem ![]()
[eluser]Guerra[/eluser]
Hi all, I encountered the same problem. When i pagination search results - page 2 is blank ![]() ![]() How do I send the post data from the controller in the model through the session? |
Welcome Guest, Not a member yet? Register Sign In |