The <input type=”submit”> creates a button to submit the form data to a form-handler.
Usually, the form-handler refers to a file on the server containing a script to process input data.
The form-handler’s location is specified in the form’s action attribute.
Example
A form featuring a submit button:
<form action=”/action_page.php”> <label for=”fname”>First name:</label><br> <input type=”text” id=”fname” name=”fname” value=”John”><br> <label for=”lname”>Last name:</label><br> <input type=”text” id=”lname” name=”lname” value=”Doe”><br><br> <input type=”submit” value=”Submit”> </form> |
It’s important to note that each input field must include a name attribute to be submitted.
If the name attribute is left out, the value of the input field won’t be sent.
Example
In this example, the value of the “First name” input field will not be submitted:
<form action=”/action_page.php”> <label for=”fname”>First name:</label><br> <input type=”text” id=”fname” value=”John”><br><br> <input type=”submit” value=”Submit”> </form> |