<form>
<!-- ...form contents... -->
<button type="submit" formaction="https://www.PuStudy.Com/resources/html-forms-action.html" formenctype="application/x-www-form-urlencoded">
Submit
</button>
</form>
In the above example we add the formenctype
attribute to a button control.
formenctype
AttributeThe formenctype
attribute allows you to specify the content type used to encode the form data set when it's submitted to the server.
Possible values:
application/x-www-form-urlencoded
(default)multipart/form-data
(use this when uploading files)text/plain
(use this when uploading files)The W3C says:
If the element is a submit button and has aformenctype
attribute, then the element's enctype is that attribute's state; otherwise, it is the form owner'senctype
attribute's state.
<button>
ElementThe <button>
element creates a button control in an HTML document.
Any contents of the <button>
element appears on the button.
The <button>
element can be associated with a form or stand alone by itself (in such case it could have JavaScript attached via the onclick
attribute) to make the button actually do something.