HTML <input> Tag with the 'formmethod' Attribute

<form>
<!-- ...form contents... -->

<input type="submit" formaction="http://www.PuStudy.Com/resources/html-forms-action.html" formmethod="post">

</form>

In the above example we add the formmethod attribute to an <input> element.

The formmethod attribute allows you to specify the HTTP method to use when the control is submitted.

Possible values:

  • 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 formmethod attribute, then the element's method is that attribute's state; otherwise, it is the form owner's method attribute's state.