Summary -

In this topic, we described about the Formenctype with detailed example.

Formenctype attribute used to override the enctype attribute of the <form> element. Formenctype attribute used to specify how the form data should be encoded when the form submitted to the server using POST method.

The formenctype attribute mainly used to override the form element enctype attribute. Formenctype attribute specifies how the data encoded when submitting the form to the server using POST method.

We can use this attribute with input types submit and image (type="submit" or type="image"). We can set this attribute with values - application/x-www-form-urlencoded (default), multipart/form-data (no encoding) or text/plain.

The default value if not included is application/x-www-formurlencoded.

Syntax -

<input type="submit" value="Submit" formenctype="application
                                         /x-www-form-urlencoded">

Example -

Below example describes about how to formaction attribute used with submit element.
<html>
 <head>
    <title>Autofocus Example</title>
 </head>
   <body>
      <form action="form-action.php" >
         <label for="username">Username: </label>
         <input type="text" name="username" id="username">
         <label for="password">Password: </label>
         <input type="password" name="password" id="password">
         <input type="submit" value="submit" formenctype="application
                                        /x-www-form-urlencoded">
      </form>
   </body> 
</html>  

Output -