The above example demonstrates usage of the <form>
element.
The <form>
element represents a form in an HTML document. A form is a collection of form-associated elements, some of which can represent editable values that the user can submit. Once submitted, a script on the server can process the form.
For example, it could send an email, insert data into a database, provide feedback to the user, and more. Such a script could do all of these things or none of them. However, the <form>
element is not involved in any of that. It simply represents the collection of form-associated elements that are displayed to the user.
Form-associated elements mean that the element can have a form owner. The form-associated elements are:
A form can contain other elements too — it doesn't have to be a form-associated element in order to be nested between the <form>
and </form>
tags. For example, you can include <p>
, <div>
and <span>
elements within a form.