Why aren't you using the $_POST or $HTTP_POST_VARS array?

--
Gaylen
[EMAIL PROTECTED]
Home http://www.gaylenandmargie.com/
PHP KISGB v2.6 Guest Book http://www.gaylenandmargie.com/phpwebsite/

"Philip Maciver" <[EMAIL PROTECTED]> wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
> Does anyone know if it is possible to use the
>
> 'global $varName'
>
> function with the '$GLOBALS' array itself.
>
> I have been having some trouble with this. I have decieded to switch of
register_globals in the php.ini file (seeing as
> it is now deprecated in version 4.1.0)
> I know that register_globals is still supported, but I would like to get
used to not using it.
> But anyway, the problem I am having is that when I post data from a form
to another page the data is not available
> globally, so I wrote a method to register them globally, it looks like
this
>
> function globaliseVars($varArray) {
> global $GLOBALS;
>
> while (list($varName,$var) = each($varArray)) {
> $GLOBALS[trim($varName)] = trim($var);
> }
> }
>
> But doing 'global $GLOBALS' doesn't seem to make it refer to the actual
'$GLOBALS' array, the only time it did work was
> when I place something into the '$GLOBALS' array on the page that calls
the function. So
>
> /**
> * This doesn't work
> */
> globaliseVars($HTTP_POST_VARS);
>
>
> /**
> * But this does
> */
> $GLOBALS["ANYTHING"] = "anything";
> globaliseVars($HTTP_POST_VARS);
>
> If anyone could help me with this problem please could they get in touch,
because its driving me crazy.
>
> Thanks!
>
> ==============
> Philip MacIver



-- 
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