I have a form with 8-10 different fields that people can search a database with. The results are displayed in tabular form upon submission of a search. You then have the ability to sort that query by clicking on the column header you would like to sort by. I do this now by storing the query as a session variable.
HOWEVER, the problem with my approach is that the values the user has entered or selected in the search form disappear upon sorting the result set. The "sort" variable is sent via GET, so when they click to sort by Client Name, for instance, they are taken to "jobs.php?sort=client". By storing the user's search query as a session variable, I'm able to take the query and just tack on the sorting at the end of the query. However, I really want to be able to keep the user's selections in the form selected.
Is there any way I can turn the sortable column headers into forms that submit via POST and still retain the old values of the form? It would be easy to insert them into hidden fields, except for the fact that many of the POST variables that need to be saved are actually arrays that correlate with multiple-select dropdown boxes.
Sorry if any of this is unclear... I can explain further if needed. I just wanted to see if anyone had any ideas on how to go about this?
HOWEVER, the problem with my approach is that the values the user has entered or selected in the search form disappear upon sorting the result set. The "sort" variable is sent via GET, so when they click to sort by Client Name, for instance, they are taken to "jobs.php?sort=client". By storing the user's search query as a session variable, I'm able to take the query and just tack on the sorting at the end of the query. However, I really want to be able to keep the user's selections in the form selected.
Is there any way I can turn the sortable column headers into forms that submit via POST and still retain the old values of the form? It would be easy to insert them into hidden fields, except for the fact that many of the POST variables that need to be saved are actually arrays that correlate with multiple-select dropdown boxes.
Sorry if any of this is unclear... I can explain further if needed. I just wanted to see if anyone had any ideas on how to go about this?