HTML | <button> formmethod Attribute
The HTML button formmethod Attribute is used to specify the HTTP method used to send data while submitting the form. There are two kinds of HTTP methods, which are GET and POST. this Attribute is only used with the Button type=”submit”
Syntax:
<button type="submit" formmethod="get|post">
Attribute values:
- GET: In the GET method, after the submission of the form, the form values will be visible in the address bar of the new browser tab. It has a limited size of about 3000 characters. It is only useful for non-secure data not for sensitive information.
- POST: In the post method, after the submission of the form, the form values will not be visible in the address bar of the new browser tab as it was visible in the GET method. It appends form data inside the body of the HTTP request. It has no size limitation. This method does not support bookmark the result.
Example: This Example illustrate the use of formmethod Attribute in Button Element.
<!DOCTYPE html> <html> <head> <title> Button Formmethod attribute </title> </head> <body style="text-align: center"> <h1 style="color: green"> GeeksforGeeks </h1> <h4> HTML Button Formmethod Attribute </h4> <form action="#" method="post" enctype="multipart/form-data"> First name: <input type="text" name="fname"> <br><br> Last name: <input type="text" name="lname"> <br><br> Address: <input type="text" name="Address"> <br><br> <button type="submit" formmethod="GET"> submit using GET </button> <br> <br> <button type="submit" formenctype="text/plan" formmethod="POST"> submit using POST </button> </form> </body> </html> |
Output:

Supported Browsers: The browsers supported by HTML <button> Formmethod attribute are listed below:
- Google Chrome 9.0
- Internet Explorer 10.0
- Firefox 4.0
- Opera 10.6
- Safari 5.1
Recommended Posts:
- HTML | input formmethod Attribute
- HTML | DOM Button formMethod Property
- HTML | DOM Input Submit formMethod Property
- HTML | DOM Input Image formMethod Property
- HTML | dir Attribute
- HTML | max attribute
- HTML | <bdo> dir Attribute
- HTML | alt attribute
- HTML | <a> rel Attribute
- HTML | for Attribute
- HTML | <img> src Attribute
- HTML | value Attribute
- HTML | name Attribute
- HTML | <map> name Attribute
- HTML | min Attribute
If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to contribute@geeksforgeeks.org. See your article appearing on the GeeksforGeeks main page and help other Geeks.
Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.



