note 22529 added to faq.installation
| From: | jdwayside at netscape dot net | Date: | Fri, 21 Jun 2002 01:19:15 +0000 |
| Subject: | note 22529 added to faq.installation | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-32067@lists.php.net to get a copy of this message | ||
Att. K. Raju:
The global variables associated with POST, GET, SESSION, etc. are no longer enabled by default (as
of PHP 4.2.0 IIRC). You have two choices.
1. Say you have a text input named "myfield" in a form that uses the POST method -- you
can employ the global variable
$HTTP_POST_VARS["myfield"]
or the superglobal
$_POST["myfield"].
2. Just using
$myfield
won't work any longer unless you explicitly set
register_globals = On
in your php.ini file. For security and other reasons (such as avoiding variable name collisions in
your code), it's better if you update your legacy code (some judicious use of regexps can
simplify this task) rather than enable globals. (Note that members of $_POST, $_GET, $_SESSION, etc.
are superglobals and don't need to be redeclared within functions, etc. as is the case with
$HTTP_POST_VARS, $HTTP_GET_VARS, etc.) For more info,
http://www.php.net/manual/en/configuration.php#ini.register-globals
and
http://www.php.net/manual/en/language.variables.predefined.php
(#language.variables.superglobals)
would be excellent places to start.
Hope you find this useful.
jon stephens
--
http://www.php.net/manual/en/faq.installation.php
http://master.php.net/manage/user-notes.php?action=edit+22529
http://master.php.net/manage/user-notes.php?action=delete+22529
http://master.php.net/manage/user-notes.php?action=reject+22529