Re: Is this a BUG?

From: Date: Sun, 23 Jun 2002 22:52:26 +0000
Subject: Re: Is this a BUG?
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-103502@lists.php.net to get a copy of this message
In article <000c01c21b02$4b69e1b0$1aed0dd1@gateway>, icaam@icaam.com.ar (César aracena) wrote: > I have a mainusers.php page, which only calls for functions > instead of writing them all together inside that page. At one step, it > calls for an “adduser” function which brings a table that let the > administrator insert a new user. After the submit button is pressed, it > calls for a function called “useradded” which resides in the same > library as the “adduser” function. This useradded function queries the > database, inserting the user. The problem is that it does not get the > HTTP POST VARS although they are being passed according to phpinfo.php. Without an example to look at, I may be mis-understanding your situation. But it sounds like this may be a scoping issue: trying to use a global ($HTTP_POST_VARS) within a function without using the special "global" keyword. This won't work: function adduser() { echo "LOCAL SCOPE: " . $HTTP_POST_VARS['user']; } adduser(); This will: function adduser() { global $HTTP_POST_VARS['user']; echo "GLOBAL SCOPE: " . $HTTP_POST_VARS['user']; } adduser(); If this is the problem you're having, you can find more information at: http://php.net/variables.scope http://php.net/global -- CC

« previous php.general (#103502) next »