form
Definition and Usage
The <form> tag is used to create an HTML form for user input. The HTML <form> tag is used for creating a form for user input. A form can contain textfields, checkboxes, radio-buttons and more. Forms are used to pass user-data to a specified URL. The<form>
tag is used in conjunction with form-associated elements. To create a form, you typically nest form-associated elements inside the opening/closing <form>
tags. You can also use the form
attribute within those elements to reference the ID of the form to use. When a form is submitted, all fields on the form are being sent.
The HTML <form>
element represents a document section that contains interactive controls to submit information to a web server.
The <form> element can contain one or more of the following form elements:
- <input>
- <textarea>
- <button>
- <select>
- <option>
- <optgroup>
- <fieldset>
- <label>
<form>
tag is written as <form>
</form>
with any number of form-associated elements nested between the start and end tags. You can add all kinds of HTML tags between the <form> and </form> tags. The <form>
tag usually has an action
attribute specified (which specifies the page that will process the form). It can also have other attributes. See below under "Template" for a list of attributes that can be used with the <form>
element.