note 15081 deleted from function.getenv by sander

From: Date: Sun, 07 Apr 2002 12:44:03 +0000
Subject: note 15081 deleted from function.getenv by sander
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-28903@lists.php.net to get a copy of this message
PROBLEM: environment variable HTTP_POST_VARS undefined (Since many people with this problem will probably search THIS place, I'll put this snippet here.) SOLUTION: When you're inside a function, don't forget to declare $HTTP_POST_VARS or imported form identifiers as GLOBALS, because otherwise you won't REACH them from inside the function. Instead, PHP will always state: 'Undefined variable ...'. (I was nearly desperating after 2 days with this stupid problem.) Use: function xy() { global $HTTP_POST_VARS, $EMAIL, $NAME; ... and things will be ok. Regards, Daniel

« previous php.notes (#28903) next »