Zend Framework 2 Paginating Search Results

343 views Asked by At

I'm making a complex search form with a lot of inputs to query and I want to paginate the search results using Zend Framework 2. I've found a few people who are trying to do something similar but I have yet to find a good solution.

Some people suggested switching to $_GET method instead of $_POST but i would prefer to avoid this because of the number of form elements.
The results are coming up fine, but as soon as i try to navigate to the second page, the query is lost and it is essentially paginating all records on the table. What is the best way to store the original search query so that the paginated results are the actual results?

I can't imagine ZF2 doesn't have an easy way to paginate $_POST results but I haven't been able to figure it out yet

1

There are 1 answers

0
Exlord On

well you either need to repost the search parameters on every page request or keep the search parameters in a session and on the second request check if the request is get or post and use the session if it is get