Close

HTML Form

[Updated: Feb 11, 2016, Created: Feb 11, 2016]

HTML 

Also known as: Web form

An HTML form allows user to send data to the server. A typical HTML form looks like this

<form action="http://www.example.com/user"
method="post"
enctype="application/x-www-form-urlencoded">

User Name: <input type="text" name="user-name"><br>
... .. .. . .
</form>

Attributes:

action: The value of this attribute is the url where we want to submit the data.

method: The HTTP method for the form submission. Only GET and POST are supported (till HTML5). We use small letters as the attribute value. Default value is get. For GET method the form data is included as query string. For POST method the data is included in the body of the message.

enctype: This is the encoding type. The encoding is performed by the browser or the web client we are using before transmitting the request. Possible values for this attributes are application/x-www-form-urlencoded (default) and multipart/form-data. HTML5 introduced new value text/plain as well.

The child nodes of input form element are visual widgets for user input.



Reference:
HTML Form Specs