I am asking because I am making a redirect appending this bit to the incoming url: ?someothervar=test
My question is obviously: what happens if the incoming url already has a querystring (such as ?var1=blah&var2=ok) and I append to it ?someothervar=test ? Should I test for every incoming request to check if a querystring already exists?
$url = 'http://somesite.com/?var1=blah&var2=ok'; // your existing url
// now you can append it like this by checking if ? exists:
$url .= (strpos($url, '?') === false) ? '?' : '&';
$url .= 'someothervar=test';
echo $url;
Hello, read it and the examples, I’m still not sure how the url should be formed. Parsing it is only a secondary concern. I just want the browser to recognize the fragment identifier AND use the querystring with PHP.
I didn’t get that when I tried it (fragment coming through in GET value).
What does your link href look like in the HTML source (i.e. how is PHP rendering the URL)?