[thelist] post variable availability

Phil Turmel pturmel-webdev at turmel.org
Thu Feb 28 12:03:55 CST 2008

Nan Harbison wrote:
> Hi All,
> This keeps coming back to bite me, I keep expecting that if I am using an
> include or require file on a web page, the $_POST variables should be
> available to that code as well as the actual page I am on, but this is not
> true is it? So do I have to save the variable as a $_SESSION variable or is
> there a better way?
> I hope I have made my question clear here.
> Thanks,
> Nan

Hi Nan,

In PHP, the $_POST, $_GET, $_SESSION and $_SERVER arrays are 
"superglobals" [1], and are available in ALL included scripts, 
function scopes, and class scopes.

If you are trying to reference an expected item in one of these 
arrays, and can't, there's something else wrong.



[1] http://www.php.net/manual/en/language.variables.predefined.php

Need to contact me offlist?
   Drop -webdev or you probably won't get through.

More information about the thelist mailing list