</> ConvertAtlas Developer Tools
Forms Lesson 8 Beginner 13 min

Forms and Inputs

Collect information from users — the form element, input types, and the all-important label.

Forms are how the web collects information — logins, sign-ups, searches, contact pages, checkouts. They have many pieces, so this lesson focuses on the foundations: the form element, the most useful input types, and labels.

The form element

A form wraps the fields users fill in, using the <code>&lt;form&gt;</code> element. Inside it go inputs, labels and a submit button. Here is how a form sends its data when submitted.

<form> Submit nameemail Serverreceives data
A form collects input and, on submit, sends the data for processing.

Inputs and the label element

The <code>&lt;input&gt;</code> element is the workhorse of forms. Its <code>type</code> attribute changes what it collects. Every input should have a <code>&lt;label&gt;</code> — connect them by matching the label's <code>for</code> to the input's <code>id</code>. Labels make forms accessible and let users click the label to focus the field.

HTML · editable
A simple form — try filling it in.

Common input types

Choosing the right input type improves the experience — for example, <code>type="email"</code> shows an email keyboard on phones and checks the format. Here are the ones you will use most.

typeCollects
textA single line of text
emailAn email address (with checking)
passwordHidden characters
numberA number, with up/down arrows
checkboxA yes/no or multi-select option
radioOne choice from a group
dateA date, with a date picker

name and value

The <code>name</code> attribute labels the data when the form is submitted — without it, the field is not sent. The <code>value</code> holds the current content. For checkboxes and radios, <code>name</code> groups related options together.

HTML · editable
Radios share a name; only one can be picked.
Labels matterAlways pair every input with a label. It is essential for screen-reader users and makes forms easier for everyone — clicking the label focuses the field.
Try it yourself: a contact form

Build a contact form in the editable box with four labelled fields: a text input for name, an email input, a number input for age, and a submit button. Make sure each label's for matches its input's id.

Quick quiz

1. Which element wraps a form?

2. How do you connect a label to an input?

3. Which input type checks for a valid email format?

4. What does the name attribute do?

5. How do radio buttons know they belong together?

Key takeaways
  • Forms wrap inputs in a <form> element with a submit button.
  • Every input needs a <label> (match label for to input id).
  • The type attribute picks what an input collects (text, email, number...).
  • name labels the submitted data; radios with one name form a group.