Hey,

Why doesn't HTTP_POST_VARS work inside functions?

---somefile.php - forms action ---

function foo() {
       reset($HTTP_POST_VARS);
        while( list($key, $val) = each($HTTP_POST_VARS) ) {
                if ( $key != "Submit" xor $key != "x" xor  $key != "y" ) {
                 $input[$key] = $val;
                 }
       }
       return $input;
}

$input = foo();

---

I thought the above would work but it returns the following error(s):

...  value passed to reset is not an array or object ...
... value passed to each is not an array or object ...

It seems that HTTP_POST_VARS does not like being called from inside 
functions, as the above will work if not inside the function,  I thought 
that HTTP_POST_VARS was in the global scope (as of php 4.0.3 track-vars 
is always on) , so it should have no problem being called from anywhere?

Does anyone know what gives?

Regards,

Joseph



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]

Reply via email to