1. Home
  2. Knowledge Base
  3. PHP
  4. PHP and the Submit Button of HTML Forms
  1. Home
  2. Knowledge Base
  3. HTML
  4. PHP and the Submit Button of HTML Forms

PHP and the Submit Button of HTML Forms

The HTML Submit button is used to submit form data to the script mentioned in the ACTION attribute. Here’s ours:

<Form Name ="form1" Method ="POST" ACTION = "basicForm.php">

So the page mentioned in the ACTION attribute is basicForm.php. To Submit this script, you just need a HTML Submit button:

<INPUT TYPE = "Submit" Name = "Submit1" VALUE = "Login">
You don’t need to do anything special with a Submit button – all the submitting is done behind your back. As long as SUBMIT has an ACTION set, then your data will get sent somewhere. But the NAME attribute of the Submit buttons comes in very handy. You can use this Name to test if the form was really submitted, or if the user just clicked the refresh button. This is important when the PHP script is on the same page as the HTML form. Our Submit button is called “Submit1”, but you can call it almost anything you like.

 

Now that you know about METHOD, ACTION, and SUBMIT, we can move on to processing the data that the user entered. First, how to get values from our text box.

Was this article helpful?

Related Articles