So sprach Joseph Blythe am Wed, Apr 18, 2001 at 10:48:14AM +0930:
> Hey,
>
> Why doesn't HTTP_POST_VARS work inside functions?
>
> ---somefile.php - forms action ---
>
> function foo() {
>reset($HTTP_POST_VARS);
Because this particular HTTP_POST_VARS is not the HTTP_POST_VARS you have
Rasmus Lerdorf wrote:
> It is a normal global variable. Like all other global variables you need
> to declare the fact that you want the global variable inside a function.
> Simply put: global $HTTP_POST_VARS; at the top of your function and it
> will work just fine.
>
> Read the section on var
> 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
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" ) {
$inpu
4 matches
Mail list logo