HTML <input> formmethod Attribute

The formmethod attribute on an <input> button specifies the HTTP method to use when the form is submitted. This attribute only applies to input types submit and image.



The second <input> button has a formmethod attribute.
It overrides the method of the form.

<form action="/tutorial/action.html" method="post">
  <input type="text" name="email" placeholder="Enter your email">

  <input type="submit" value="Submit using POST"/>
  <input type="submit" formmethod="get" value="Submit using GET" />

Using formmethod

The formmethod attribute overrides the form's method attribute.

This attribute specifies which HTTP method will be used when form data is sent to the server.

If this attribute is set to get, the form data will be sent using URL name-value pairs.

If post is used, the data will be sent as an HTTP post transaction.

This attribute can only be used for input which types are submit or image.


<input type="submit | image" formmethod="get | post">



Value Description
get Sends the form-data using URL name-value pairs (e.g. URL?firstname=Wilsom&lastname=Smith).
post Sends the form-data as an HTTP post transaction.
This method should be used when the data being sent is sensitive (e.g. passwords, bank information).

Browser support

Here is when formmethod support started for each browser:

1.0 Dec 2008
1.0 Nov 2004
10.0 Sep 2012
10.6 Oct 2010
5.1 Oct 2011

You may also like

 Back to <input>