On Mon, Mar 04, 2002 at 08:49:09AM +0100, Thomas Wentzel wrote :
> file2.php:
> <?
> session_start();
> $old=$foo;
> parse_str($QUERY_STRING);
>
> Header("Location: file3.php?old=$old&foo=$foo");
> ?>
>
> file3.php:
> <?
> session_start();
> echo "foo: $foo<br>";
> ?>
>
> >From the manual: (explanation for parse_str)
> Parses str as if it were the query string passed via an URL and sets
> variables in the current scope. If the second
> parameter arr is present, variables are stored in this variable as an
> array elements instead.
>
> I would expect that the script would result in file3.php echoing, "foo:
> foobar" - but that's not the case, instead I get: "foo: bar", but the
> url is: "file3.php?old=bar&foo=foobar". Doesn't session_start introduce
> all the registered vars into the current scope - and since parse_str
> "sets varibles in the current scope" why doesn't this scheme work?
Session variables (in global scope) are set AFTER Post/Get
vars (the other way around would be a big problem since
everyone could easily modifiy your holy session variables).
- Markus
--
Please always Cc to me when replying to me on the lists.
GnuPG Key: http://guru.josefine.at/~mfischer/C2272BD0.asc
--
PHP Development Mailing List <http://www.php.net/>
To unsubscribe, visit: http://www.php.net/unsub.php