RE: [PHP] Updating a GET variable
| From: | admin at buskirkgraphics dot com | Date: | Wed, 10 Nov 2010 02:52:30 +0000 |
| Subject: | RE: [PHP] Updating a GET variable | ||
| References: | 1 2 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-309419@lists.php.net to get a copy of this message | ||
No,
Try this.
<?php
Session_start();
$_SESSION['language'] = "en";
You can set the session variable to the current get or maintain the original
passed.
May I also make a suggestion to that horrid string you presented?
<a href='<?php echo $_SERVER['SCRIPT_NAME'] ;?>?<?php echo
$_SERVER['QUERY_STRING']; ?>&lang=en'>Flip</a>
Dear god, why would you butcher php like that?
I, like many prefer short code or at least concat the string.
<a href='<?php echo
"$_SERVER[SCRIPT_NAME]"."?$_SERVER[QUERY_STRING]";?>&lang=en'>Flip</a>
Richard L. Buskirk
-----Original Message-----
From: Marc Guay [mailto:marc.guay@gmail.com]
Sent: Tuesday, November 09, 2010 3:48 PM
To: ash@ashleysheridan.co.uk
Cc: php-general
Subject: Re: [PHP] Updating a GET variable
> What's wrong with just putting the url parameters in the link that you
know
> you need, one by one?
I have a footer that I include on every page and would like it to
adapt to whatever situation it finds itself in. Is your suggestion,
to do the following for the existing example:
echo "<a
href='index.php?name=".$_GET['name']."&this=".$_GET['this']."&lang=en'>Flip<
/a>";
> Also, don't just output the values sent to the server, as that's an
attack waiting to happen.
Are you referring to echoing the SCRIPT_NAME and QUERY STRING values
into the href attribute?
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php