Variable issues

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
almostsane
Forum Newbie
Posts: 13
Joined: Sat Jan 10, 2004 3:26 am

Variable issues

Post 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.
User avatar
markl999
DevNet Resident
Posts: 1972
Joined: Thu Oct 16, 2003 5:49 pm
Location: Manchester (UK)

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