I have a script that queries a database, which works fine.
Now i want to allow a user to be able to change the way its ordered by using a dropdown menu, i managed to do this ok.
I also want the user to be able to filter the data, this i can also do! Combining the two functions together is proving a nightmare.
When a user selects order by date from the jump menu, the page is reloaded and depending on option selected the variable is added to the url, e.g. view.php?orderby=date
When the user selects the filter option it will do the same as above e.g. view.php?category=21
I have coded it so that both jump menus look at the url and add there variable on the end using
$PHP_SELF . "?" .$HTTP_SERVER_VARS['QUERY_STRING'];
The trouble comes when the variables have already been set so $PHP_SELF . "?" .$HTTP_SERVER_VARS['QUERY_STRING']; causes probs
e.g. view.php?category=21 could become view.php?category=21?category=21
How can i tell ifs it already set and if so change the existing variable to contain the new value.