References

Collection of references for web development.

HTML form tag

Description

The HTML <form> element represents a section in the document that contains interactive elements, commonly used to submit information to a web server.

Attributes

Attribute Value Description
accept-charset type (e.g. UTF-8) Specifies a comma-separated list of character encodings that the server accepts.
action URL Specifies where to send the form information when it's submitted.
autocomplete on
off
Specifies if form elements should be automatically completed by the browser.
enctype application/x-www-form-urlencoded (default)
multipart/form-data
text/plain
Specifies the MIME type used when posting the form information to a server.
method get
post
Specifies the HTTP method used when submitting the form.
name string Specifies the name of the element.
novalidate boolean Specifies whether the form should be validated or not.
target _self
_blank
_parent
_top
framename
Specifies where to display the URL.

Example

<form action="authenticate.php" method="post">
	Username: <input type="text" name="uname"><br>
	Password: <input type="password" name="pword"><br>
	<input type="submit" value="Submit">
</form>

Example #2

<form action="uploadfile.php" method="post" enctype="multipart/form-data">
    Select file:
    <input type="file" name="fileupload"><br>
    <input type="submit" value="Upload" name="submit">
</form>