How can redirect the user back to the same page with the existing Query Strings but have 1 added/modified like "page".
I suppose 1 method is:
- parse the
$_SERVER['QUERY_STRING']
into an array - if
page
exists in the array, modify the value, else add it - use
http_build_query
to get the query string to append to$_SERVER['PHP_SELF']
but is there a better/more direct way?
Just to make sure you know about it, use
parse_str
to parse your query string:Using Jim Rubinstein's answer, I came up with a useful function that I thought I might share:
For example:
<a href="?<?=modQuery(array('kind'=>'feature'))?>">Feature</a>