php_self and passing variables
Posted: Mon Apr 25, 2005 9:07 am
I want to add one variable to the end of the page's current url.
I thought of doing:
That works great in all cases except when the current url is something like:
http://www.url.com/start/index.php?ID=7
The first problem is that $_SERVER['PHP_SELF'] will not return the "?ID=7" part.
The second problem is that, even if it did, the final url would be:
http://www.url.com/start/index.php?ID=7?variable
That doesn't make sense either.
Is there a workaround so that PHP_SELF returns the part after the ? as well?
I thought of doing:
Code: Select all
<a href="e;<?PHP echo $_SERVERї'PHP_SELF']?>?variable"e;>link</a>http://www.url.com/start/index.php?ID=7
The first problem is that $_SERVER['PHP_SELF'] will not return the "?ID=7" part.
The second problem is that, even if it did, the final url would be:
http://www.url.com/start/index.php?ID=7?variable
That doesn't make sense either.
Is there a workaround so that PHP_SELF returns the part after the ? as well?