HTML · Lesson 8 of 9
Forms
Inputs, labels, buttons and built-in validation.
Forms collect input. Every input should have a <label> — click the label and the input gets focus, and screen readers announce it.
- Input types:
text,email,tel,number,date,password,checkbox,radio,file. - Other controls:
<select>,<textarea>,<button>. - Validation attributes:
required,minlength,maxlength,min,max,pattern. nameis the key sent to the server;actionandmethodon the form say where and how.
Try it yourself
Edit the code and press Run (or Ctrl/⌘ + Enter). Code runs only in your browser, in a sandbox.
Key points
- Pair every input with a label.
- Pick the right type — email, tel, date…
- required and pattern give free validation.
Quick check
Which attribute stops a form from submitting while a field is empty?
required makes the browser block submission until the field has a value.
Practice task
Build a job application form with name, email, phone (type=tel), a resume upload (type=file) and a required consent checkbox.
Interview corner
GET vs POST for forms?
GET puts data in the URL — fine for searches. POST sends it in the request body — use it for creating data, logins and anything sensitive.
Is HTML validation enough?
No. It improves user experience, but anyone can bypass it, so the server must always validate again.
Further reading
Official documentation, linked for deeper study. These are outside sites; this lesson's text is our own.
Original lesson written by the InfoparkDaily team · © 2026 InfoparkDaily · Free to learn — no paid course or subscription.