NYCPHP Meetup

NYPHP.org

[nycphp-talk] $_POST

Hans Zaunere zaunere at yahoo.com
Sat May 24 22:43:49 EDT 2003


--- Webapprentice <webapprentice at onemain.com> wrote:
> Chris Shiflett wrote:
> > --- "Christopher R. Merlo" <cmerlo at turing.matcmp.ncc.edu> wrote:
> > 
> >>Also, if you disable globals (generally a good idea), $_POST won't
> >>work anymore.  Replace with $HTTP_POST_VARS.
> > 
> > 
> > That's not quite right. $HTTP_POST_VARS and $_POST are the same thing.
> $_POST
> > was added in 4.1.0 to make it more convenient to use. What
> register_globals
> > does is register variables sent from the client into globals, so that you
> can
> > use $foo instead of $_POST['foo'] (or $HTTP_POST_VARS['foo'] if you use
> an
> > older version).
> > 
> > Chris
> 
> Unless you know what host environment you are going to be in, one may 
> opt to use $HTTP_POST_VARS['foo'].  I've run into several hosts who have 
> not upgraded the engine, so $_POST doesn't work.

Unfortunately, this can be an issue.  However, I also try to make the code as
"forward thinking" as possible.

$_POST = &$HTTP_POST_VARS;

at some top level include, or under a conditional that checks for a php
version, can make migrations easier.  There are still of course global scope
issues, but it's better than nothing.  But, I feel it's important to use the
newer superglobals (which aren't even that new anymore).  And of course not
register_globals!  :)

H





More information about the talk mailing list