Updating a GET variable

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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



[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux