enctype ( HTML attribute )

In html, the use of enctype attribute is to indicate how form data should be encoded before it being sent to the location defined by action attribute. By default, a form data which contains spaces are converted to “+” symbols, and special characters such as apostrophes, percentage and other symbols are converted to their relevant ASCII codes.

The default value of enctype attribute is “application/x-www-form-urlencoded“(it does need to be set explicitly).It make sure that all form data characters are encoded before they are sent to the server.

Other possible values of enctype attribute are “multipart/form-data” which is suitable when using a file upload form(where no character encoding takes place but transfers form data as a compound MIME document) and “text/plain” which converts spaces to “+” symbols but other special symbols like apostrophes remain in their original format.

Example

<form action="address.php" method="get" enctype="text/plain">
  <div>
    <label for="txtname">Full Name:</label>
    <input type="text" name="txtname" id="txtname"/>
  </div>
  <div>
    <label for="txtcontacttel">Contact Tel:</label>
    <input type="text" name="txtcontacttel" id="txtcontacttel"/>
  </div>
  <div>
    <input type="submit" name="cmdSubmit" id="cmdSubmit"
        value="Send personal details"/>
  </div>
</form>

Browser Compatibility

There are no compatibility issues with popular browsers like IE, Firefox, Safari, Opera and Chrome. They provides excellent support to function successfully.

Advertisements

Posted on February 20, 2013, in Web and tagged , , , . Bookmark the permalink. Leave a comment.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: