This is Video 7 of ManoraTech's free 30-video web development course. You will build a complete contact form: connect every label to its input with for and id, choose the right input type (text, email and tel, and meet date, number and password), add a select dropdown, radio buttons in a fieldset and a checkbox, then a textarea and a submit button. You will switch on the browser's built-in validation with required, and see where form data goes: the default GET method puts it in the address bar, and real websites send it to a server or a form service such as Formspree with the post method. By the end, the HTML version of your website is complete.
What you will learn
- Build a form with form, label, input, textarea, select and button.
- Use the input types text, email, tel, radio and checkbox (and know date and number exist).
- Connect labels to inputs with for and id; use name, placeholder and required.
- Understand that sending form data needs a server or a form service.
Key takeaways
- Every field needs a label: connect them with for and id.
- Choose the right input type: email and tel make forms easier on phones.
- Radio buttons in one group share the same name; a checkbox is only sent when it is ticked.
- required gives you free browser validation, but real form data needs a server or a form service.
What you will build
contact.html becomes a complete contact form. The email-link paragraph from Video 6 is replaced by a form with:
- a name field (
type="text"), an email field (type="email") and an optional phone field (type="tel") - a "What is it about?" dropdown (
selectwith threeoptionelements) - a
fieldsetwith alegendand two radio buttons that sharename="reply"(By email ischecked) - a newsletter checkbox
- a message box (
textarea, 5 rows) and a submit button requiredon the name, email and message fields, so the browser checks them before sending
Every label is connected to its field with for = the field's id, and every field has a name.
This folder is the finished HTML version of the personal website and the fixed starting point for Video 8 (CSS). index.html is unchanged since Video 6.
Where does the data go?
actionis where the data goes.action="#"means "this same page", so the form works on any static server (Live Server, GitHub Pages) without a back-end.methodis how it is sent. The default isGET, which puts the data in the address asname=valuepairs joined by&. Never useGETfor passwords or private data.- HTML cannot store or email messages by itself. A real site sends the data to a server (back-end code) or to a form service such as Formspree: the service gives you an address to put in
action, you addmethod="post"(which keeps the data out of the address bar), and it emails each message to you. - A field without a
nameattribute is not sent at all, the most common form mistake.
The code from this lesson
This is the code as it is at the end of the video. Copy it into VS Code and open the page with Live Server to see it in your browser.
index.html Home page (identical to Video 6)
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Sara Ahmed | Aspiring Web Developer</title>
</head>
<body>
<header>
<h1>Sara Ahmed</h1>
<p>Aspiring web developer · Coffee lover · Lifelong learner</p>
<nav>
<ul>
<li><a href="index.html">Home</a></li>
<li><a href="#about">About</a></li>
<li><a href="#skills">Skills</a></li>
<li><a href="contact.html">Contact</a></li>
</ul>
</nav>
</header>
<main>
<!-- About me -->
<section id="about">
<h2>About Me</h2>
<figure>
<img src="images/avatar.svg" alt="Illustration of Sara smiling, with dark hair and a yellow top" width="200" height="200">
<figcaption>That's me — learning to code one line at a time.</figcaption>
</figure>
<p>Hi! I'm <strong>Sara</strong>, and I'm learning web development from scratch. I started this course because I want to build websites for small businesses — and maybe one day for my own.</p>
<p>When I'm not coding, you'll usually find me with a cup of <em>very</em> strong coffee and a good book.</p>
<h3>My Hobbies</h3>
<ul>
<li>Photography</li>
<li>Reading mystery novels</li>
<li>Cooking new recipes</li>
<li>Hiking on weekends</li>
</ul>
<h3>My Goals This Year</h3>
<ol>
<li>Finish this web development course</li>
<li>Build and publish three websites:
<ul>
<li>A personal website (this one!)</li>
<li>A to-do list app</li>
<li>A website for a local business</li>
</ul>
</li>
<li>Get my first freelance client</li>
</ol>
</section>
<!-- Skills table -->
<section id="skills">
<h2>Skills I'm Learning</h2>
<table>
<caption>My learning progress</caption>
<thead>
<tr>
<th scope="col">Skill</th>
<th scope="col">Level</th>
<th scope="col">Started</th>
</tr>
</thead>
<tbody>
<tr>
<td>HTML</td>
<td>Beginner</td>
<td>Week 1</td>
</tr>
<tr>
<td>CSS</td>
<td>Starting soon</td>
<td>Week 2</td>
</tr>
<tr>
<td>JavaScript</td>
<td>Starting soon</td>
<td>Week 4</td>
</tr>
</tbody>
</table>
</section>
<!-- Links -->
<section id="links">
<h2>Find Me Online</h2>
<ul>
<li><a href="https://github.com/" target="_blank" rel="noopener">GitHub</a></li>
<li><a href="https://www.linkedin.com/" target="_blank" rel="noopener">LinkedIn</a></li>
<li><a href="mailto:hello@example.com">Email me</a></li>
</ul>
</section>
</main>
<footer>
<p>© 2026 Sara Ahmed. Built with HTML while learning web development.</p>
</footer>
</body>
</html>
contact.html Contact page with the complete form
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Contact | Sara Ahmed</title>
</head>
<body>
<header>
<h1>Sara Ahmed</h1>
<p>Aspiring web developer · Coffee lover · Lifelong learner</p>
<nav>
<ul>
<li><a href="index.html">Home</a></li>
<li><a href="index.html#about">About</a></li>
<li><a href="index.html#skills">Skills</a></li>
<li><a href="contact.html">Contact</a></li>
</ul>
</nav>
</header>
<main>
<section id="contact">
<h2>Contact Me</h2>
<p>Have a question or a project idea? Send me a message and I'll reply within two days.</p>
<!-- action="#" keeps us on this page for now. A real site sends the data to a server or a form service. -->
<form action="#">
<div>
<label for="name">Full name</label>
<input type="text" id="name" name="name" placeholder="e.g. Ali Khan" required>
</div>
<div>
<label for="email">Email</label>
<input type="email" id="email" name="email" placeholder="you@example.com" required>
</div>
<div>
<label for="phone">Phone (optional)</label>
<input type="tel" id="phone" name="phone" placeholder="+1 555 123 4567">
</div>
<div>
<label for="topic">What is it about?</label>
<select id="topic" name="topic">
<option value="question">A question</option>
<option value="project">A project idea</option>
<option value="hello">Just saying hello</option>
</select>
</div>
<fieldset>
<legend>How should I reply?</legend>
<input type="radio" id="reply-email" name="reply" value="email" checked>
<label for="reply-email">By email</label>
<input type="radio" id="reply-phone" name="reply" value="phone">
<label for="reply-phone">By phone</label>
</fieldset>
<div>
<input type="checkbox" id="newsletter" name="newsletter" value="yes">
<label for="newsletter">Send me tips about learning to code</label>
</div>
<div>
<label for="message">Your message</label>
<textarea id="message" name="message" rows="5" placeholder="Write your message here..." required></textarea>
</div>
<button type="submit">Send message</button>
</form>
</section>
</main>
<footer>
<p>© 2026 Sara Ahmed. Built with HTML while learning web development.</p>
</footer>
</body>
</html>
Practice challenge
Add a "How did you find me?" dropdown with three options and a date input labelled "Best day to call". Then submit the empty form and read what the browser tells you.
Show the solution
The solution is in contact.html below. Two new fields, each wrapped in a div like the others:
- After the phone field:
<label for="call-day">Best day to call</label>and<input type="date" id="call-day" name="call-day">, the browser shows a date picker. - After the topic dropdown:
<label for="source">How did you find me?</label>and a<select id="source" name="source">with three options (A search engine, Social media, A friend).
When you submit the empty form, the browser does not send it. It jumps to the first empty required field (Full name) and shows a small message such as "Please fill out this field." (the exact words depend on your browser and language). Fill in the name and try again: the browser moves on to the email field. Type an email without an @ and it complains about the missing @. The new date and dropdown fields are not required, so they never block the form, and after a successful send their values appear in the address bar as call-day=... and source=....
contact.html Solution
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Contact | Sara Ahmed</title>
</head>
<body>
<header>
<h1>Sara Ahmed</h1>
<p>Aspiring web developer · Coffee lover · Lifelong learner</p>
<nav>
<ul>
<li><a href="index.html">Home</a></li>
<li><a href="index.html#about">About</a></li>
<li><a href="index.html#skills">Skills</a></li>
<li><a href="contact.html">Contact</a></li>
</ul>
</nav>
</header>
<main>
<section id="contact">
<h2>Contact Me</h2>
<p>Have a question or a project idea? Send me a message and I'll reply within two days.</p>
<!-- action="#" keeps us on this page for now. A real site sends the data to a server or a form service. -->
<form action="#">
<div>
<label for="name">Full name</label>
<input type="text" id="name" name="name" placeholder="e.g. Ali Khan" required>
</div>
<div>
<label for="email">Email</label>
<input type="email" id="email" name="email" placeholder="you@example.com" required>
</div>
<div>
<label for="phone">Phone (optional)</label>
<input type="tel" id="phone" name="phone" placeholder="+1 555 123 4567">
</div>
<!-- Challenge: a date input -->
<div>
<label for="call-day">Best day to call</label>
<input type="date" id="call-day" name="call-day">
</div>
<div>
<label for="topic">What is it about?</label>
<select id="topic" name="topic">
<option value="question">A question</option>
<option value="project">A project idea</option>
<option value="hello">Just saying hello</option>
</select>
</div>
<!-- Challenge: a second dropdown -->
<div>
<label for="source">How did you find me?</label>
<select id="source" name="source">
<option value="search">A search engine</option>
<option value="social">Social media</option>
<option value="friend">A friend</option>
</select>
</div>
<fieldset>
<legend>How should I reply?</legend>
<input type="radio" id="reply-email" name="reply" value="email" checked>
<label for="reply-email">By email</label>
<input type="radio" id="reply-phone" name="reply" value="phone">
<label for="reply-phone">By phone</label>
</fieldset>
<div>
<input type="checkbox" id="newsletter" name="newsletter" value="yes">
<label for="newsletter">Send me tips about learning to code</label>
</div>
<div>
<label for="message">Your message</label>
<textarea id="message" name="message" rows="5" placeholder="Write your message here..." required></textarea>
</div>
<button type="submit">Send message</button>
</form>
</section>
</main>
<footer>
<p>© 2026 Sara Ahmed. Built with HTML while learning web development.</p>
</footer>
</body>
</html>
Quick quiz
Check what you learned. Pick an answer to see if it is right.
Question 1 of 3How do you connect a <label> to an <input>?
Show the answer
D. Give the input an id and the label a matching for attribute <label for="email"> pairs with <input id="email">. Clicking the label focuses the input and screen readers announce it.
Question 2 of 3Which input type shows an email keyboard on phones and checks for an @ sign?
Show the answer
B. type="email" type="email" gives built-in validation and the right keyboard on mobile.
Question 3 of 3Radio buttons in the same group must share the same…
Show the answer
D. name Radios with the same name form one group, so only one of them can be selected.
Frequently asked questions
How do you connect a label to an input in HTML?
Give the input an id and the label a for attribute with exactly the same value, for example label for="name" and input id="name". Clicking the label then puts the cursor in the box, and screen readers read the label aloud.
What is the difference between the id and name attributes of an input?
id connects the field to its label and must be unique on the page. name is the name of the data when the form is sent. A field without a name is never sent.
Which input type should I use for email addresses and phone numbers?
Use type email for email addresses: phones show a keyboard with an @ key, and the browser checks for an @ before sending. Use type tel for phone numbers: phones show a number pad, but the browser does not check the format.
When should I use radio buttons, a checkbox or a dropdown?
Radio buttons are for one answer from a few options, and buttons in one group share the same name. A checkbox is a simple yes or no, and its value is only sent when it is ticked. A select dropdown is best when there are many options.
What does the required attribute do?
It tells the browser that the field cannot be empty. When someone clicks the submit button, the browser stops and shows a message on the first empty field. It is a helpful first check, but a real server must always check the data again.
Where does HTML form data go when you click Send?
To the address in the action attribute. With the default GET method, the data appears in the address bar as name=value pairs. HTML cannot store or email messages by itself, so real websites send the data to a server or to a form service such as Formspree, with the post method.
Read the full transcript
0:00 Welcome to ManoraTech
Hello, and welcome to ManoraTech! This is Web Development for Beginners, a free course in thirty short videos. This is video seven: HTML Forms, Inputs, Labels and Buttons.
0:17 Forms are everywhere
Every login box, every search bar and every checkout page is a form. Forms are how visitors talk back to a website. Today you will build a complete contact form, with text fields, a dropdown, radio buttons, a checkbox and a big message box. The browser will even check the answers for you.
And you will see exactly what happens when someone clicks Send. This is the last piece of the HTML version of your website.
0:46 The form tag, labels and inputs
Open contact dot html. Delete the paragraph with the Email me link, because the form replaces it. Your email link still lives on the home page. Now add a form element. A form is a container for input fields, and it sends their values somewhere when someone clicks the button.
The action attribute says where to send them. For now, we use a hash, and you will learn why at the end of this video. The first field is for the name. Every field has two parts. The label is the visible text that says what to type.
The input is the box where you type. I wrap each pair in a div, the neutral box from the last video, so every field sits on its own line. Look closely. The input has an id with the value name, and the label has a for attribute with the same value.
Those two must match exactly, because that is what connects them. Now clicking the label puts the cursor in the box, and screen readers read the label aloud. The input is an empty element, so it has no closing tag. Type text means one line of text.
The name attribute is the name of this piece of data when the form is sent. The placeholder is the light grey example inside the box. It disappears when you start typing, so it can never replace a label.
2:13 Input types that help users
The type attribute changes how an input behaves, and the right type makes life easier for your visitors. Type email tells the browser that this box needs an email address. On phones, it shows a keyboard with the at sign. And before the form is sent, the browser checks that the answer really contains an at sign.
Type tel, short for telephone, shows a number pad on phones. The browser does not check the format, because phone numbers look different in every country. I write optional in the label, so visitors know they can skip this field. Notice that every field has its own id, and every label points to it.
The placeholders show an example of a good answer, in the right format. The email check runs when the form is sent, and you will see it in action in a moment. There are many more types. Type date shows a calendar to pick a day.
Type number accepts only numbers, and adds small arrows to count up and down. Type password hides what you type behind dots. And if a browser does not know a type, it simply shows a normal text box, so trying new types is always safe.
3:28 Radio buttons, checkboxes and select
Sometimes visitors should choose instead of type. A select element creates a dropdown list. Each option inside it has two parts: the value, which is what the form sends, and the text, which is what the visitor sees. Keep each value short and simple, with no spaces.
For a short choice with only one answer, use radio buttons. Radio buttons in the same group must share the same name, here reply. That is how the browser knows that selecting one clears the other. Each button still gets its own id for its label, and its own value.
The checked attribute selects By email from the start. The fieldset draws a box around related fields, and the legend gives that box a title. Click the label By phone, and its radio button gets selected, thanks to for and id. Last, a checkbox, for a simple yes or no.
Each checkbox works on its own, and its value is only sent when it is ticked. Which one should you choose? Use radio buttons when there are only a few options, so visitors see every choice at once. Use a dropdown when there are many options.
Quick pause! If you are enjoying this video, please give it a like. And if you are new here, kindly subscribe to ManoraTech, and press the bell icon, so you get a notification for every new lesson. Thank you! Now, let us keep going.
4:58 textarea, button and required
A message needs more than one line. The textarea element creates a box with many lines, and the rows attribute sets its height. Unlike input, textarea has a closing tag, and visitors can drag its corner to make it bigger. Finish the form with a button of type submit.
Clicking it sends the form, so make its text say exactly that: Send message. Notice the word required at the end of the textarea. The required attribute means that this field cannot be empty. Add it to the name and email inputs too. Now click Send message with an empty form.
The browser stops and shows a small message on the first empty field, asking you to fill it in. Type a name, then an email without an at sign, and try again. Now the browser complains about the email. This is called form validation, and you get it for free.
It is a helpful first check, but a real server must always check the data again.
6:02 Where does the data go?
Fill in the whole form and click Send message. The page reloads, and the fields are empty again. But look at the address bar. After a question mark, you see each field's name, an equals sign, and the value. This default method is called GET, and it puts the form data into the address.
Common mistake: forgetting the name attribute. A field without a name is never sent. Our action is a hash, which means this same page. HTML cannot store or email messages by itself. Real websites send the data to a server, or to a form service such as Formspree.
A form service gives you an address for the action attribute, and it emails every message to you. They also use the post method, which keeps the data out of the address bar. Add this comment above your form as a reminder. And never send passwords with GET.
Congratulations: the HTML version of your website is complete!
7:06 Practice challenge
Your turn. Add two new fields to your form. First, a dropdown with the label How did you find me, and three options, for example a search engine, social media and a friend. Second, a date input with the label Best day to call. Use your topic dropdown as a model.
Remember: every label needs a for attribute that matches its field's id, and every field needs a name. Then submit the empty form, and read what the browser tells you. Pause the video now and try it. The solution is in the course files linked in the description.
7:43 Quick quiz
Quick quiz time! Three questions about this video. Answer out loud, or pause the video and write your answers in the comments. Question one. How do you connect a label to an input? A: Put the label after the input. B: Use the same class on both.
C: Labels connect automatically. D: Give the input an id and the label a matching for attribute. The answer is D. A label with for set to email pairs with an input whose id is email. Clicking the label focuses the input, and screen readers announce it.
Question two. Which input type shows an email keyboard on phones and checks for an at sign? A: type text. B: type email. C: type mail. D: type address. The answer is B. Type email gives built-in validation and the right keyboard on mobile. Question three.
Radio buttons in the same group must share the same... A: Id. B: Value. C: Label. D: Name. The answer is D. Radios with the same name form one group, so only one of them can be selected.
9:11 Outro and next video
Today you built a complete contact form, with labels, input types, a dropdown, radio buttons, a checkbox and built-in validation. You also learned where form data goes. Your HTML website is finished! In the next video, CSS Basics: Selectors and How Styles Apply, it gets its first real style.
Comment below with your challenge result. Thank you for watching ManoraTech! If you liked this video, please give it a like, subscribe to the channel, and press the bell icon, so you never miss a new lesson. I will see you in the next video.
Goodbye!