php - Search and pagination, how to get search term after form has been submitted -


i'm creating search feature pagination.

i have form , it's post value. use search database , return set of results.

the results broken in pages , user can click page links in view.

my question is, how can persist search on multiple pages?

should first page post value , on subsequent pages should put search term url, eg.

www.example.com/search/various-keywords/p2 

then term , query database again, splitting results whatever page is, p2, p3, p4 etc.

is there cleaner way this?

also, unsafe include users input in url? should encode in way?

and if user click after going through number of pages 'confirm form resubmission' error. how can prevent this?

the best way making search term get variable can retrieve , add url want.

as long escape search query should fine user security, remove re-submission of form error.


Comments

Popular posts from this blog

javascript - RequestAnimationFrame not working when exiting fullscreen switching space on Safari -

Python ctypes access violation with const pointer arguments -