HTML formmethod Attribute
Description
The formmethod attribute in HTML is used to specify the method by which the form data should be submitted to the server. It can be applied to <button> or <input> elements within a form, overriding the default or specified method attribute of the form element itself. This attribute provides flexibility in defining submission behaviors for specific buttons or input elements within the same form.
The formmethod attribute provides an easy way to configure different submission methods for multiple submit buttons within the same form, allowing for more complex interactions and behaviors in web forms.
Syntax
<tagname type="submit" formmethod="get | post">
Values
- getThis value specifies that the form data should be appended to the form's
actionURL, with the fields in the form becoming parameters in the query string of the URL. TheGETmethod is typically used for form submissions where the user is requesting data from the server, without intending to create or update resources. - postThis value indicates that the form data should be included in the body of the HTTP request. The
POSTmethod is commonly used for form submissions that create or update data on the server because it does not expose the form data in the URL, offering a more secure way of transmitting sensitive information.
Example
Browser Support
The following information will show you the current browser support for the HTML formmethod attribute. Hover over a browser icon to see the version that first introduced support for this HTML attribute.
This attribute is supported by all modern browsers.
Desktop
Tablets & Mobile
Last updated by CSSPortal on: 29th March 2024
