views:

49

answers:

4

Hello!

I want to do a search with pagination, but I don't know how to 'store' the data in the $_POST array, should I do it with sessions?

Rolensen

A: 

Yes, you can use sessions or hidden fields and even better GET method in your form.

Sarfraz
Query string, all the way. It's the only sane way to get bookmarks, back/forward and reload to work intuitively. Using hidden fields to build the query string is of course viable, just use GET as method in your form.
roe
A: 

you should read some articles on this page: http://www.google.at/search?q=php+pagination+tutorial

Rufinus
You're very helpful, I've used google before asking, but I haven't found any helpful information. I you can help only in this way, then please don't.
Rolensen
come on, i checked the first 3 links, and all answering your question... http://www.allsyntax.com/tutorials/PHP/23/Pagination-with-PHP/2.php http://net.tutsplus.com/tutorials/php/how-to-paginate-data-with-php/ http://www.ittreats.com/os/php/php-pagination-tutorial.html i cant help you understand technical (lol) documentation
Rufinus
+2  A: 

If you are doing a search, you are trying to GET data from the server, and not send data to it -- which means you probably should use GET, and not POST.

Also, it would allow your users to bookmark the result pages (or send those links by e-mail, IM, ...), which is always nice ; and, also, use the back/forward buttons of the browser without getting an alert box, which is nice too ^^

(Oh, and, BTW, it would help solve your problem ;-) )

Pascal MARTIN
A: 

It is possible to use both GET and POST:

<form action="index.php?page=5">

So the pager links are submit buttons while rest of the data is stored in hidden fields. But that's not a good way to do this because you cannot pass someone link (on IM for example) to your search results.

But the best way is to store somewhere POST input data (look here: http://www.symfony-project.org/plugins/, when you input your query once, it is stored and remembered so you dont need to fill form multiple times)

Ziells