Page 1 of 1

Pagination where POST is critcal

Posted: Wed Jul 19, 2006 10:57 pm
by LiveFree
Hello All!

Say I have a musical rating/search system and based on how many 'hits' (matches with the searched text vs the database), that decides wherether or not it will be displayed.

The problem is, I need to paginate this page but I cant just use $_GET because the $_POST info from the Search form still needs to be available.

Any suggestions on how to paginate and still keep the POST data?

Thanks!

*My god its hot here, even in Boston!*

Posted: Thu Jul 20, 2006 2:55 am
by JayBird
Store the POST data in a session

Posted: Thu Jul 20, 2006 2:58 am
by RobertGonzalez
My usual, run a query for all the records and use the start and limit from paging in your for loop. You are probably going to need to session or database the input though (like Pimptastic said) to keep it moving like what you want since what is displayed will be dictated by the user.

Posted: Thu Jul 20, 2006 3:04 am
by HubGoblin
use SESSIONS

Re: Pagination where POST is critcal

Posted: Thu Jul 20, 2006 3:38 am
by timvw
There are a couple of options:

- store the posted data in a form on the paginated page (and make sure the pagination links submit the form... thus use buttons instead of hyperlinks to do the navigation)
- append the posted data to the urls

- use sessions (which is an optimised version of the two options mentionned above)

Posted: Thu Jul 20, 2006 6:01 am
by Benjamin
You may be able to use POST and GET at the same time depending on your design..

Code: Select all


<form name="example" method="POST" action="yourPage.php?page=3&this=that?">
    <input ... />
</form>


Posted: Thu Jul 20, 2006 10:37 am
by LiveFree
So Many Ideas!

I've decided to test out using hidden fields on my page. And the links generated by a for would have the onclick="form.submit()" event attrib.

Thanks Everyone! :)