Don't think about it in those terms and you'll see why it wasn't working. Http is stateless, so unless you use sessions, it will 'forget' everything from page to page.
What's wrong with just putting the url parameters in the link that you know you need, one by one? If you have many, build a little function for it to reduce code repetition. Also, don't just output the values sent to the server, as that's an attack waiting to happen. Thanks, Ash http://www.ashleysheridan.co.uk ----- Reply message ----- From: "Marc Guay" <marc.g...@gmail.com> Date: Tue, Nov 9, 2010 20:12 Subject: [PHP] Updating a GET variable To: "php-general" <firstname.lastname@example.org> Hi folks, I'm sure this is an easy one that's standing right in front of me but I'm too blind to see. I have a page with an URL like this: index.php?name=value&this=that. I have a link on the bottom of the page which allows the user to switch languages. I need to hang onto the existing $name and $this get variables. I tried <a href='&lang=en'>Flip</a> and it loses all previous GET data. Then I tried <a href='<?php echo $_SERVER['SCRIPT_NAME'] ;?>?<?php echo $_SERVER['QUERY_STRING']; ?>&lang=en'>Flip</a> And it continually appends more &lang=en's to the URL if the user keeps clicking on it (for whatever reason). Now I've put it in a form and it works as expected, but the display value and my under-the-hood value need to be different, so it's a fail. What's the best way to update the value of a GET var? Marc -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php