-
Notifications
You must be signed in to change notification settings - Fork 38
06 ‐ Working with Forms
Sanjay Viswanathan edited this page May 28, 2025
·
2 revisions
To create a form in HTML, you need to use the
element. The element is used to define an HTML form that collects user input. Here's an example of a simple form that collects the user's name and email address:<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Simple Form</title>
</head>
<body>
<h1>Simple Form</h1>
<form>
<label for="name">Name:</label>
<input type="text" id="name" name="name" required>
<br><br>
<label for="email">Email:</label>
<input type="email" id="email" name="email" required>
<br><br>
<button type="submit">Submit</button>
</form>
</body>
</html>
<input type="checkbox" name="interest" value="coding"> Coding
<input type="checkbox" name="interest" value="design"> Design
Element The element is used to create a dropdown list within a form. It allows the user to select one or more options from a list of predefined options.
Here's an example of a element with multiple options:
<select name="country">
<option value="us">United States</option>
<option value="ca">Canada</option>
<option value="uk">United Kingdom</option>
</select>
Learn Docs