I am having a problem with passing a particular variable to a page using get. Basically, as part of the site navigation I have created an 'exploding' navigation bar on the site which is activated through a _get variable.
eg. The navigation panel has something looking like this ...
Main Topic One
Main Topic Two
Main Topic Three
....
With each being a link to explode that category. When you click Main Topic One and you're on contact.php it will send you to contact.php?qn=one. In the code I have it so that if qn == 'one' it echo's some more categories ....
Main Topic One
Sub 1
Sub 2
Sub 3
Main Topic Two
Main Topic Three
This is working great on most pages. However on pages where there are other get variables I am having problems. For example, on one of the pages view.php there could be another two _GET varivables in the url (view.php?m=module&id=365). The only way that I can find to get the hyperlinks to work is using:
echo '<a href="' . $_SERVER['PHP_SELF'] . '?' . $_SERVER['QUERY_STRING'] . '&qn=value">Link Text</a>';
This works fine for the first click - adding the qn=xxx onto the end and it all works, however it then snowballs. For example, if you then have view.php?m=module&id=365&qn=xxx all the hyperlinks on the page will be view.php?m=module&id=365&qn=xxx&qn=xxx ... I hope that makes sence.
The navigation is still working, and a printr($_GET) shows that the correct value of qn is being passed, but the url looks very ugly, as it could have an infinate number of qn=xx values on it.
Any suggestions on another way of doing this would be great. 😃
Many thanks. Jamie