Submit Button Element
After completing a web form you need something to inform the browser to send the information to the server. A submit button is used to accomplish this task and is the recommended way to submit HTML forms. It is defined using the tag <input type="submit"> and its value attribute acts as the button’s label. After clicking this button, the data is sent to the page specified in the form's action attribute which performs some actions with the received input. In the following exercise, the information is sent to a page "xyz.php" on the server. The server processes the input and returns the answer as shown in the output pane. For this purpose, we used the GET method which retrieves the inputted information from the server. Server processing is an advanced topic and will be discussed in Chapter 5 and Chapter 6. At this stage, if you click the submit button after running the example code, you'll get an error indicating that the browser could not find the file 'submit.php'. Besides SUBMIT you can use two other types, RESET and BUTTON. The RESET button sets all the form fields back to their default value, or blank. The BUTTON performs an action associated with a JavaScript event handler. If the user presses a Submit or a Reset button, you can detect it with the onSubmit or onReset event handlers. For generic buttons, you can use an onClick event handler.
Learn the HTML5 language in this tutorial series. These tutorials are designed for new programmers to provide them thorough knowledge of full stack web development.