Just as with a form element’s method attribute, the formmethod attribute of a submit button indicates the HTTP verb that should be used when submitting the data via that submit button. If omitted, the method attribute of the form element is used.
<input type="submit" value="Upload" formmethod="post" />
Valid values for formmethod are:
- GET; Default. Form submission performs an HTTP GET request and thus does not contain a request body. All request data is contained in the submission URL.
- POST; Form submission performs an HTTP POST request, with form data included as part of the request body.
When “GET” is specified, the names and values of form input elements are combined into name/value pairs and appended to the submission URL as its query string. If “POST” is specified, the values are submitted as part of the request body and encoded according to the form’s enctype attribute or the submit button’s formenctype attribute.
Example with formmethod attribute:
<form action="/update.php" method="post">
<input type="hidden" name="id" value="123" />
<input type="text" id="username" name="username" value="john1" />
<input type="submit" value="Check Availability" formmethod="get"
<input type="submit" value="Update" formmethod="post" />