![]() |
VOOZH | about |
The HTML formmethod Attribute is used to define the HTTP method that is used to send form data while submitting the form. GET and POST are the two well-known HTTP methods. This attribute overrides the feature of the method attribute of the <form> element.
Supported tags:
Syntax:
<element formmethod="get|post">Values:
Example 1: Below code demonstrates the use of formmethod attribute in the HTML <input type="submit"> control. Refer to the output given below for a better understanding. Notice the address bar of the new web page on clicking "Submit normally" and "submit using POST method". Both are different, one showing the user details and the latter hiding all the user details.
Output:
Example 2: The following example demonstrates the HTML formmethod="get" attribute using the button element. It submits the user entries to the "getDetail.php" PHP file. When the user clicks "Submit using get method", the values are submitted to the PHP file, notice the address bar in the below output.
Output:
Supported Browsers: