Trying to do an advanced search options, with sorting of different options ASC or DESC.
Example URL:
search.php?accom_type=x&no_rooms=x&rooms_total=x&prop_area=x&rent_less=&rent_more=&available=&go=Search&sd=a
Highlighted bold is &sd (sort direction) option. The previous variables are passed through a form which is filled in.
Now I have links like this..
<a href="<?=$_SERVER['REQUEST_URI']?>&sd=a">ASC</a>|<a href="<?=$_SERVER['REQUEST_URI']?>&sd=d">DESC</a>
Which is obviously wrong because I'm using REQUEST_URI - because if a person changes after it is initially set the URL will be:
&sd=a&sd=d
I'm sure I have come across this problem before, but can't quite think how I solved it.
How do I check if a GET is already set (such as sd) and if so, change it, otherwise, add it to the end of the URL, to produce the links shown above.
Edit: Maybe a screen shot would help to understand: http://dl.dropbox.com/u/10591127/Capture.PNG
Cheers, Matt
isset()to check if a variable is set.