HTML <button> formmethod Attribute
Example
<form action="action-post.php">
<label for="fname">First name:</label>
<input type="text" id="fname" name="fname"><br><br>
<label for="lname">Last name:</label>
<input type="text" id="lname" name="lname"><br><br>
<button type="submit" formmethod="post">Submit</button>
</form>
Meaning
formmethod attribute specifies how form information should be transferred to the server using a particular HTTP method.
Notes:
- The formmethod attribute is only used for buttons with type="submit".
- 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
<button type="submit" 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 |