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

Reply via email to