forms

<form>

Container for a set of input controls that are submitted together to a server. Use it any time users need to send data — search, sign-up, checkout, comments.

<form action="/submit" method="post">...</form>

Common attributes

Attribute Purpose
action URL that receives the submission
method get | post
enctype application/x-www-form-urlencoded | multipart/form-data | text/plain
target Where the response opens (_self, _blank)
autocomplete on | off for the whole form
novalidate Skip built-in HTML validation

Examples

<form action="/search" method="get"><input name="q"><button>Go</button></form>

Search form via query string

<form action="/upload" method="post" enctype="multipart/form-data"><input type="file" name="f"><button>Upload</button></form>

File upload requires multipart enctype

<form method="post" novalidate>...</form>

Disable native validation to run your own

Gotcha

File uploads require enctype="multipart/form-data" — plain forms will only send the filename. Always include a real submit control so keyboard users can submit with Enter.

Related tags

← All HTML tags · CSS selectors · HTML entities