Computer >> Computer tutorials >  >> Programming >> HTML

How to specify whether the form-data should be encoded while submitting to the server with HTML?


Use enctype attribute in HTML to set whether the form-data should be encoded while submitting to the server.

Example

You can try to run the following code to implement enctype attribute −

<!DOCTYPE html>
<html>
   <body>
      <p>Which sports do you like?</p>
      <form action = "" method = "post" enctype = "multipart/form-data">
         <input type = "checkbox" name = "vehicle" value = "football" checked> Football<br>
         <input type = "checkbox" name = "vehicle" value = "cricket" checked> Cricket<br>
         <input type = "checkbox" name = "vehicle" value = "hockey"> Hockey<br>
         <input type = "submit" value = "Submit">
      </form>
   </body>
</html>