HTML5
HTML5

HTML Forms

A form collects information from a visitor. A login form can collect an email and password. A contact form can collect a message. The <form> element wraps the controls that belong together. Inputs, labels, selects, textareas, and buttons can live inside it. The action attribute can tell the browser where to send the submitted data. The method attribute describes how the data should be sent, commonly get or post. A form is not just a box on the screen. It is a structured way to collect user input.

Why this matters

  • ·Forms let users send information.
  • ·Grouping controls inside form makes their purpose clear.
  • ·Built-in HTML validation can catch simple mistakes before submission.

Common mistakes

  • ·A form without labels can be difficult to use.
  • ·Client-side validation alone is not enough for server security.
  • ·Using the wrong name values can make submitted data difficult to process.
Your codeHTML
Live preview

Frequently asked questions

It groups controls used to collect and submit user input.

Practice questions

Question 1

Build a small name form.

Your codeHTML
Live preview

Question 2

Build a contact form with name and message.

Your codeHTML
Live preview

Quick check

Just for this topic answer honestly, then check yourself.

1 / 3

Which tag groups form controls?