Appending to the REQUEST_URI

From: Date: Wed, 28 May 2003 20:12:50 +0000
Subject: Appending to the REQUEST_URI
Groups: php.general 
Request: Send a blank email to php-general+get-149312@lists.php.net to get a copy of this message
Let's say I have a table with links in the headers for sorting each column. I want to carry the sort variable along in the $_GET array, and I need to be able to pass other variables to this same page, also using the GET method. My trouble is when I need to append a new variable to the REQUEST_URI -- I need to detect whether a QUERY_STRING has already been passed, so I won't use "?" when I need "&" in the URI. Here's my clunky attempt: <a href="<?php echo $_SERVER['REQUEST_URI']; if ($_SERVER['QUERY_STRING'] && !$_GET['newVar']) { echo "&newVar=1"; } else if (!$_SERVER['QUERY_STRING']) { echo "?newVar=1"; } ?> ">link description text</a> Please tell me there is some way to just append to the query string without checking it first... -- Matt Grimm Web Developer The Health TV Channel, Inc. (a non - profit organization) 3820 Lake Otis Parkway Anchorage, AK 99508 907.770.6200 ext. 686 907.336.6205 (fax) E-mail: mgrimm@healthtvchannel.org Web: www.healthtvchannel.org

« previous php.general (#149312) next »