HTML <button> formenctype Attribute
Example
<form action="action.php" method="get" id="formId">
<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">
<button type="submit" form="formId" value="Submit">Submit</button>
<button type="submit" formenctype="text/plain">Submit without character encoding</button>
</form>
Meaning
The formenctype attribute is set to the MIME type for how data should be transmitted to the URL specified in the action attribute.
Note: The formenctype attribute is only used for buttons with type="submit".
Demo URL Encoding
First name:
Submit
Standard Syntax
<button type="submit" formenctype="value">
Advertisement
Attribute Values
| Value | Description |
|---|---|
| application/x-www-form-urlencoded | (Default) All characters will be encoded before sending data. |
| multipart/form-data | This value is necessary if the upload a file through the form. (img, video, etc...) |
| text/plain | Sending data without any encoding. (Not recommended) |