HTML <button> with formenctype Attribute

You are Here:

HTML <button> with formenctype Attribute

The formenctype attribute specifies how to encode a form-data before sending it to a server.

Note: The formenctype attribute is only used for buttons with type="submit".

application/x-www-form-urlencoded

Used to send characters with encoding, when a form is submitted. This is the default behavior.

Example

HTML Online Editor
<!DOCTYPE html> <html> <body> <form action="/form-urlencoded.php" method="get"> Name: <input type="text" name="myname"> <button type="submit" formenctype="application/x-www-form-urlencoded">Submit</button> </form> </body> </html>

Attribute Value

ValueExplanation
application/x-www-form-urlencodedUsed to send characters with encoding, when a form is submitted. This is the default behavior.
multipart/form-dataUsed to send images, files, etc., when a form is submitted.
text/plainUsed to send characters without encoding, when a form is submitted.

multipart/form-data

Used to send images, files, etc., when a form is submitted.

Example

HTML Online Editor
<!DOCTYPE html> <html> <body> <form action='/multipart.php' method='post'> <input type="file" name="userFile"> <button type="submit" formenctype="multipart/form-data">Submit</button> </form> </body> </html>

text/plain

Used to send characters without encoding, when a form is submitted.

Example

HTML Online Editor
<!DOCTYPE html> <html> <body> <form action="/text-plain.php" method="get"> Name: <input type="text" name="myname"> <button type="submit" formenctype="text/plain">Submit</button> </form> </body> </html>

Reminder

Hi Developers, we almost covered 99.5% of HTML Tutorials with examples for quick and easy learning.

We are working to cover every Single Concept in HTML.

Please do google search for:

Join Our Channel

Join our telegram channel to get an instant update on depreciation and new features on HTML, CSS, JavaScript, jQuery, Node.js, PHP and Python.

This channel is primarily useful for Full Stack Web Developer.

Share this Page

Meet the Author