HTML enctype attribute

The enctype attribute defines the type of content that is used to store and transmit the data of form.

Example

<p> If simple text is submitted, then enctype is html. </p>
 <form action="files/enctype.php" method="post" enctype="text/html">
  Email: <input type="email" name="email"> <br>
  Password: <input type="password" name="password"> <br>
  <input type="submit" name="login" value="login"> <br>
</form>
Try </>

enctype attribute values

enctype attribute is an enumerated attribute that has more than one values.

See the example given above.

enctype='text/html':

It indicates that the only plain text is sent.

application/x-www-form-urlencoded:

This is the default attribute. In this method non-ASCII characters can not be sent. Form is encoded as follows.

  • space characters are converted to '+'

  • alphanumeric characters are converted to '%HH' (percent with two hexadecimal digits)

  • line breaks are converted to '%0D%0A'.

enctype='multipart/form-data':

multipart attribute is used when the data includes files, data (Non-ASCII) and binary data. It should be used to send large quantity of data.

Related Tags

<form> tag

The form element supports the enctype attribute. The form collects the data from the user.



Was this article helpful?

 

Email:

Message:

Get the newsletter