How can I add GET variables to the end of the current page url using a form with php?

Posted by zeckdude on Stack Overflow See other posts from Stack Overflow or by zeckdude
Published on 2010-06-18T10:29:44Z Indexed on 2010/06/18 10:33 UTC
Read the original article Hit count: 559

Filed under:
|
|
|

I have some database information that is being shown on a page.

I am using a pagination class that uses the $_GET['page'] variable in the url. When you click on a different pagination anchor tag, it changes $_GET['page'] to a new number in the url and shows the corresponding results.

I have sort and search features which uses the $_GET['searchby'] and $_GET['search_input'] variables. The user enters their search or sort criteria on a form that is using GET. The variables are then put into the url allowing for the correct results to be shown.

The problem I am having is that whenever I click on a pagination link, it adds that to end of the url and erases the search or sort GET variables. The same thing happens when I submit the search/sort form. How can I add GET variables to the end of the current page url using the anchor tag and search/sort form?

© Stack Overflow or respective owner

Related posts about php

Related posts about forms