Search...

HTML Forms

An HTML form is used to collect user input. The user input is most often sent to a server for processing.

The <form> Element

The HTML `<form>` element is used to create an HTML form for user input:

<form>
.
form elements
.
</form>

The `<form>` element is a container for different types of input elements, such as: text fields, checkboxes, radio buttons, submit buttons, etc.

The <input> Element

The HTML `<input>` element is the most used form element. An `<input>` element can be displayed in many ways, depending on the `type` attribute.

Form Input Example
Result

The Action Attribute

The `action` attribute defines the action to be performed when the form is submitted. Usually, the form data is sent to a file on the server when the user clicks on the submit button.

If the action attribute is omitted, the action is set to the current page.