Replying to myself... :) > You have to check for it, regardless. See if this works for you. > > $url = $_SERVER['REQUEST_URI'] . '?' . ((isset($_SERVER['QUERY_STRING'])) ? > $_SERVER['QUERY_STRING'] . '&' : '' ) . 'newVar=1'; > > The middle part basically sees if the QUERY_STRING is empty. If it is, it > includes a question mark otherwise it includes an apersand. Actually, to be > fully compliant, replace the & with & in your URLs.
I changed the code and forgot to fix the above paragraph. The middle part sees if QUERY_STRING is set, if it is, it includes it's value and appends an ampersand to the end, then includes the new var. The question mark has to be included no matter what, since it's not a part of the query string variable. Actually, the easiest way would just be to use: $url = $_SERVER['REQUEST_URI'] . '?' . @$_SERVER['QUERY_STRING'] . '&newVar=1'; The @ will suppress any warnings about undefined index. You may end up with www.domain.com?&newVar=1, but it'll still work. Don't know if it's "compliant" or what... but.... :) ---John Holmes... -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php