Pagination and $ _POST

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

Rolensen

+3
source share
3 answers

If you perform a search, you are trying to get data from the server, rather than sending data to it - this means that you should probably use GET, not POST.

In addition, it will allow users to bookmark results pages (or send these links by email, IM, ...), which is always nice; as well as use the "Back / Forward" buttons of the browser without getting a warning window, which is also good. ^^

(, , , ;-))

+5

, GET .

0

GET, POST , method to form:

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

Thus, the pager links are submit buttons, while the rest of the data is stored in hidden fields. But this is not a good way to do this, because you can’t pass someone a link (for example, to IM) to the search results.

But it is best to store some POST input (see here: http://www.symfony-project.org/plugins/ , when you enter the request once, it is stored and remembered, so you do not need to fill out the form several times)

0
source

Source: https://habr.com/ru/post/1733035/


All Articles