- Attribute of
- Input As The Fundamental Form Element In HTML: Here's What It Does
- What does
- Specifies the HTTP method (GET or POST) to be used when the form data is submitted to the server. Only for use on input types of "submit" or "image".
formmethod attribute specifies the HTTP method (
POST) which will be used when the form is submitted. This can also be specified for the form within the
<form> element, using the
method attribute — in fact, the options are exactly the same. Using
formmethod on the submission input can take the place of the
<form> attribute, or override it. It is hard to think of any compelling use cases for this attribute. The only sensible reason to specify the method at the level of the submission button (instead of the
<form>), is if you wanted to provide multiple submission buttons with different HTTP methods. However, that gives the user an option that probably is not best left up to the user. Perhaps in experimental or test applications, or in some particularly advanced use case, this might be a useful attribute. However, in general, you should probably just specify the HTTP method using the
<form method=""> attribute.
Browser Support for formmethod