Class:8th HTML Programs related to Form
1. Basic HTML Form
This program introduces input fields like text, email, and password.
<!DOCTYPE html>
<html>
<head>
<title>Basic Form</title>
</head>
<body>
<h2>Simple Form</h2>
<form>
Name: <input type="text" name="name"><br><br>
Email: <input type="email" name="email"><br><br>
Password: <input type="password" name="password"><br><br>
<input type="submit" value="Submit">
</form>
</body>
</html>
2. Form with Radio Buttons and Checkboxes
This teaches how to use selection options in a form.
<!DOCTYPE html>
<html>
<head>
<title>Form with Radio and Checkbox</title>
</head>
<body>
<h2>User Preferences</h2>
<form>
Gender:
<input type="radio" name="gender" value="Male"> Male
<input type="radio" name="gender" value="Female">
Female<br><br>
Hobbies:
<input type="checkbox" name="hobby" value="Reading"> Reading
<input type="checkbox" name="hobby" value="Sports"> Sports
<input type="checkbox" name="hobby" value="Music">
Music<br><br>
<input type="submit" value="Submit">
</form>
</body>
</html>
3. Form with Dropdown and Textarea
This program adds a dropdown menu and a text area for comments.
<!DOCTYPE html>
<html>
<head>
<title>Form with Dropdown and Textarea</title>
</head>
<body>
<h2>Feedback Form</h2>
<form>
Select Country:
<select name=”country”>
<option value=”India”>India</option>
<option value=”USA”>USA</option>
<option value=”UK”>UK</option>
</select><br><br>
Comments:<br>
<textarea name=”comments” rows=”4”
cols=”30”></textarea><br><br>
<input type=”submit” value=”Submit”>
</form>
</body>
</html>
4. Form with Date and File Upload
This introduces date selection and file uploads.
<!DOCTYPE html>
<html>
<head>
<title>Form with Date and File Upload</title>
</head>
<body>
<h2>Upload Your Details</h2>
<form>
Date of Birth: <input type="date" name="dob"><br><br>
Upload File: <input type="file" name="file"><br><br>
<input type="submit" value="Submit">
</form>
</body>
</html>