note 15081 added to function.getenv.php

From: Date: Mon, 27 Aug 2001 15:39:22 +0000
Subject: note 15081 added to function.getenv.php
Groups: php.notes 
Request: Send a blank email to php-notes+get-17211@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 http://www.php.net/manual/en/function.getenv.php

« previous php.notes (#17211) next »