Week 1 Day 3: HTML Forms 📝
Creating Forms to Collect Information
👋 Selam Campers! Welcome to Day 3 of Fullstack Summer Camp! You’ve already learned how to structure a page using
➾headings
➾paragraphs
➾images
➾links. Now it’s time to interact with your users — and for that, we use something powerful: **Forms**!
━━━━━━━━━━━━━━━━━
━━━━ 🧠 What is a Form in HTML?
A **form** is how we collect data from users on a website. It’s like a digital paper form — just like the ones you fill at school, clinics, or offices.
📋Real-life examples of forms:
- Login & registration pages
- Survey or feedback forms
- Online order checkout forms
- Assignment submissions
━━━━━━━━━━━━━━━━━
━
🏗️ <form> Tag – The Form Container
All form elements go inside a <form> tag.
<form> <!-- form elements go here --> </form>This tells the browser, “Everything inside here is part of a single form.” ━━━━━━━━━━━━━━━━━━ 🔠 Common Input Types (with Examples) Text Input – For short answers like name
<label for="name">Name:</label>
<input type="text" id="name" name="name">
Email Input – For collecting emails
<label for="email">Email:</label>
<input type="email"
id="email"
name="email"
placeholder="you@example.com"
required>
Password Input – Hides the characters
<label for="password">Password:</label>
<input type="password" id="password" name="password">
Textarea – For long messages or comments
<label for="message">Your Message:</label><br>
<textarea id="message" name="message" rows="4" cols="30"></textarea>
Radio Buttons – Pick one option only
<p>Gender:</p>
<input type="radio" id="male" name="gender" value="male">
<label for="male">Male</label>
<input type="radio" id="female" name="gender" value="female">
<label for="female">Female</label>
Checkboxes – Choose multiple options
<p>Skills:</p>
<input type="checkbox" id="html" name="skills" value="HTML">
<label for="html">HTML</label>
<input type="checkbox" id="css" name="skills" value="CSS">
<label for="css">CSS</label>
Dropdown (Select)
<label for="department">Department:</label>
<select id="department" name="department">
<option value="cs">Computer Science</option>
<option value="se">Software Engineering</option>
<option value="it">Information Technology</option>
</select>
Date Picker
<label for="dob">Date of Birth:</label>
<input type="date" id="dob" name="dob">
File Upload
<label for="photo">Upload your photo:</label>
<input type="file" id="photo" name="photo">
Submit Button – To send the form
<input type="submit" value="Submit">
Reset Button – To clear all fields
<input type="reset" value="Clear">
━━━━━━━━━━━━━━━━━━━
📦 Useful Attributes
↪️ placeholder – Shows hint inside input
<input placeholder="Enter your name">↪️ required – Prevents empty submission
<input required>↪️ value – Sets a default value
<input value="Addis Ababa">━━━━━━━━━━━━━━━━━━ 📚 Optional: Grouping Use <fieldset> to group related inputs and give the group a title using <legend>.
<fieldset>
<legend>Personal Info</legend>
<label for="fullName">Full Name:</label>
<input type="text" id="fullName">
</fieldset>
━━━━━━━━━━━━━━━━━━━
🌍 Example – Group Assignment Form
<h2>Group Assignment Submission</h2>
<form>
<label for="university">University Name:</label>
<input type="text" id="university" name="university"><br><br>
<label for="department">Department:</label>
<input type="text" id="department" name="department"><br><br>
<label for="group">Group Members:</label><br>
<textarea id="group" name="group" rows="3" cols="40"></textarea><br><br>
<label for="date">Submission Date:</label>
<input type="date" id="date" name="date"><br><br>
<input type="submit" value="Submit">
</form>
💡 Try it in your editor
━━━━━━━━━━━━━━━━━━━
#Week1 #Day3 #Html #Forms #lesson10 7月 2025, 10:50
