HTML Forms

HTML Forms are used to collect data from the user or send data across the web.
It can also be used as an interface for web applications.

  Do It Yourself

HTML form elements are input, button, textarea, select, fieldset, legend, and label elements, while the input elements can contain checkboxes, radio buttons, text fields, submit button, and many more.

HTML Forms - Text Fields

Text fields are input fields where a user can enter a text in an HTML form.

HTML Text Fields are defined by adding type="text" to an <input> element.

<input type="text" />
The text value of the type attribute makes it a text field

Example

A text field is only used to write a single line text.

You will be thought how to write a text in multiple lines later in this lesson.

HTML Forms - Password Fields

Password fields are input fields where a user can enter a text but appears in an encoded form.
This may be in form of a circle or asterisks(*).
Password fields are used to provide private and sensitive information.

HTML Password Fields are defined by adding type="password" <input> element.

<input type="password" />
The password value of the type attribute makes it a password field

Examplel

a

An HTML form is submitted when a user strikes the submit button. The browser now delivers the user's information to the server.

How This Works

  • The user enters a data
  • Browser delivers the data to the server
  • The server executes the result.

Submit Button

A submit button is used to send data to the server. The data is sent to a page in the form attribute specified.

HTML Submit Button is defined by parsing the type="submit" <input> element.

<input type="submit" />
The submit value of the type attribute makes it a submit button

Example

The value the attribute in the above example defines the text that should be on the submit button.

What You Should Know at the End of This Lesson

  • You should know that an HTML Form is used to collect data form a user.
  • You should know that the password fields are used to collect sensitive information from the user.
  • You should be the submit button is clicked by the user to submit the data provided in an HTML Form.
  • You should be able to create a simple HTML login form yourself.
You will be thought how to style a form in the next lesson.