Re: HTTP_POST_VARS empty!

From: Date: Wed, 12 Mar 2003 19:06:49 +0000
Subject: Re: HTTP_POST_VARS empty!
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-139363@lists.php.net to get a copy of this message
Vincent M. wrote:
Hello, I don't understand this code empty my HTTP_POST_VARS variable: if ((get_magic_quotes_gpc() == 1)) { switch ($REQUEST_METHOD) { case "POST":
    while (list ($key, $val) = each ($HTTP_POST_VARS)) {
      $$key = stripslashes($val);
    }
    break;
case "GET":
    while (list ($key, $val) = each ($HTTP_GET_VARS)) {
      $$key = stripslashes($val);
    }
    break;
} } This script is usefull to simulate get_magic_quotes_gpc to 0 but if I do it it empty my HTTP_POST_VARS and this code does not work:
    while(list ($key, $val) = each($HTTP_POST_VARS)) {
      echo "$key => $val<br>";
    }
    echo "Here we are...!!!..." ;
It displays, "Here we are...!!!..." but nothing at all for $key and for $val How should I do to simulate get_magic_quotes_gpc to 0 without emptying HTTP_POST_VARS ? Thanks, Vincent. PS: If I delete the code ...(get_magic_quotes_gpc() == 1)...it works...
ok, It seems to empty the HTTP_POST_VAR variable when we parse it with while(list ($key, $val) = each($HTTP_POST_VARS)) { ... } So I can't do this while 2 times :-( and I need to do it several times! Does anyone know how to parse $HTTP_POST_VARS whithout emptying this variable ? Thanks.

« previous php.general (#139363) next »