<form> <!-- ...form contents... --> <button type="submit" formaction="https://www.PuStudy.Com/resources/html-forms-action.html" formmethod="post"> Submit </button> </form>
In the above example we add the
formmethod attribute to a button control.
formmethod attribute allows you to specify the HTTP method to use when the control is submitted.
get(the form data is appended to the URL when submitted)
post(the form data is not appended to the URL)
dialog(specifies that submitting the form is intended to close the dialog box in which the form finds itself, if any, and otherwise not submit.)
The W3C says:
If the element is a submit button and has a
formmethodattribute, then the element's method is that attribute's state; otherwise, it is the form owner's
<button> element creates a button control in an HTML document.
Any contents of the
<button> element appears on the button.