HTML <input> formmethod Attribute
Example
<form action="action.php" method="post">
<label for="fname">First name:</label>
<input type="text" id="fname" name="fname">
<label for="lname">Last name:</label>
<input type="text" id="lname" name="lname">
<input type="submit" formmethod="get" value="Submit as get">
</form>
Meaning
The formmethod attribute indicates how form information should be transferred to the server using a particular HTTP method.
The formmethod attribute overrides the method attribute of the <form> element.
Notes:
- The formmethod attribute is only used for buttons with
type="submit" and type="image". - Never use the get method to pass sensitive information like password or other sensitive information will be visible in the browser's address bar.
- Form submissions with the post method cannot be bookmarked.
- get method has data size limitation.
- post method has no data size limitation.
Standard Syntax
HTML: <input formmethod="get|post">
XHTML: <input formmethod="get|post"/>
Advertisement
Attribute Values
| Value | Description |
|---|---|
| get | Appends the form-data to the URL |
| post | Sends the form-data as an HTTP post transaction |