Sure, Rasmus!
But...
I'm using parse_str because file2 in my example is supposed to be
a generic handler for all other scripts on my "site". Offcourse I could
use "1.5 million" $HTTP_GET_VARS for each registered session variable
(as
I wouldn't know what to expect)
The reason I did write to this list - is because there obviously is
something wrong with the way parse_str works and how it is supposed to
work.
Not because I don't know how to get around this "obstacle"
Rasmus Lerdorf wrote:
>
> You are posting to the wrong list. And why are you using parse_str()?
> PHP automatically imports these variables for you. Use
> $foo=$HTTP_GET_VARS['foo'] in that second script of yours.
>
> Next time send your user-level question like this to php-general.
>
> -Rasmus
>
> On Mon, 4 Mar 2002, Thomas Wentzel wrote:
>
> > Hi,
> >
> > I have encountered an issue with parse_str, that I believe needs to
> > be addressed - allthough I might be mistaken, and in that case feel
> > free to ridicule me - and tell me to go to the general list :)
> >
> > Well... I want to be able to do something like this:
> >
> > file1.php:
> > <?
> > session_start();
> > session_register("foo");
> > $foo="bar";
> > ?>
> > <form action="file2.php?foo=foobar" method="post">
> > <input type="submit" name="Go">
> > </form>
> >
> > 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?
> >
> > Thanks for listening
> > Thomas
> >
> >
> > --
> > PHP Development Mailing List <http://www.php.net/>
> > To unsubscribe, visit: http://www.php.net/unsub.php
> >
>
> --
> PHP Development Mailing List <http://www.php.net/>
> To unsubscribe, visit: http://www.php.net/unsub.php
--
PHP Development Mailing List <http://www.php.net/>
To unsubscribe, visit: http://www.php.net/unsub.php