Simple PHP+HTML form not detecting that it's been submitted

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
User avatar
Josh1billion
Forum Contributor
Posts: 316
Joined: Tue Sep 11, 2007 3:25 pm

Simple PHP+HTML form not detecting that it's been submitted

Post by Josh1billion »

feyd | Please use

Code: Select all

,

Code: Select all

and [syntax="..."] tags where appropriate when posting code. Your post has been edited to reflect how we'd like it posted. Please read:  [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url] to learn how to do it too.[/color]


I have a file, register.php, which will serve as the registration form and the handler for it, depending on whether it detects a form has been submitted ( through the list "if ($_FORM['username'])" ).  However, the line I just mentioned consistently returns false, skipping the handler and printing out the form as if nothing were submitted.

The query in question:

Code: Select all

if ($_FORM['username'])
	{
                 // handler goes here.. this code is never being called, not even when a form is submitted!
   }
The form:

Code: Select all

<form action="register.php" method="post">
Name: <input type="text" name="username"><BR>
Password: <input type="text" name="password"><BR>
Appearance: (this can be changed later as you progress through the game)<BR>

<input type="radio" value="1" name="character"> <img src="char_parts/fighter/full.png">
<input type="radio" value="2" name="character"> <img src="char_parts/blackmage/full.png"><BR><BR>

<input type="submit" value="Create Account">
</form>

feyd | Please use

Code: Select all

,

Code: Select all

and [syntax="..."] tags where appropriate when posting code. Your post has been edited to reflect how we'd like it posted. Please read:  [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url] to learn how to do it too.[/color]
User avatar
feyd
Neighborhood Spidermoddy
Posts: 31559
Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA

Post by feyd »

There is no superglobal $_FORM. $_POST is what you are looking for.
User avatar
Josh1billion
Forum Contributor
Posts: 316
Joined: Tue Sep 11, 2007 3:25 pm

Post by Josh1billion »

Ahh yes that was it! Thanks for catching that.
Post Reply