Attribute: Formmethod

The formmethod attribute defines the HTTP method for sending form-data to the action URL. This attribute overrides the method attribute of the <form> element. The formmethod attribute can be used with type="submit" and type="image".

In this example, the second submit button overrides the HTTP method of the form:

HTML file: Displayed by browser:
<form action="http://www.w3schools.com/html/action_page.php" method="get">
First name: <input type="text" name="fname">
<br />
<br />Last name: <input type="text" name="lname">
<br />
<br /><input type="submit" value="Submit">
<br />
<br /><input type="submit" formmethod="post" formaction="http://www.w3schools.com/html/demo_post.asp" value="Submit using POST">
</form>
First name:

Last name:



This should work with all major browsers.

Back button Table of Contents Next button