Page 1 of 1

Variable issues

Posted: Sat Jan 10, 2004 3:26 am
by almostsane
have been teaching myself PHP for the last few months.

well anyway,

i've recently gotten a new PC and have installed PHP to run on IIS. on my old PC I had PHP running on apache.

Now i want to have a search page with a form in it. the problem i am having is that it will not reconise the fields form the form as variables.

i keep getting messages such as
Notice: Undefined variable: submit in c:\inetpub\wwwroot\test\results.php on line 13.

Posted: Sat Jan 10, 2004 6:34 am
by markl999
It's the old register_globals problem.
With register_globals On form values are placed in the global scope, so a form field named "foo" becomes $foo when posted.
With register_globals Off it doesn't. You have to use $_POST['foo']

Leaving register_globals Off is recommended and has been the default since 4.2.0, you can read some more about it at http://php.net/variables.predefined