Example + Code View (Student Learning Format)
HTML forms are used to collect user input such as text, selections, passwords, files, and more. Forms are commonly used for:
<form>
<!-- input fields go here -->
</form>
Output:
Code:
<form>
<label>Name:</label><br>
<input type="text" placeholder="Enter your name" required>
<br>
<label>Age:</label><br>
<input type="number" min="1" max="100">
</form>
<form>
<label>Select Date:</label><br>
<input type="date">
<br>
<label>Select Time:</label><br>
<input type="time">
</form>
Used for booking systems, appointments, scheduling etc.
<form>
<label>Email:</label><br>
<input type="email" placeholder="example@mail.com">
<br>
<label>Password:</label><br>
<input type="password" maxlength="12">
</form>
Output:
Code:
<form>
<label>Gender:</label><br>
<input type="radio" name="gender"> Male
<input type="radio" name="gender"> Female
<br><br>
<label>Skills:</label><br>
<input type="checkbox"> HTML
<input type="checkbox"> CSS
<input type="checkbox"> JavaScript
</form>
Output:
Code:
<form>
<label>Select Course:</label><br>
<select>
<option>HTML</option>
<option>CSS</option>
<option selected>-- Choose Course --</option>
<option>JavaScript</option>
<option>PHP</option>
</select>
</form>
Output:
Code:
<form>
<label>Message:</label><br>
<textarea rows="4" cols="30"
placeholder="Type your message"></textarea>
</form>
<form>
<label>Rate:</label><br>
<input type="range" min="0" max="10">
<form>
<label>Search:</label><br>
<input type="search">
</form>
<form>
<label>Pick Color:</label><br>
<input type="color">
</form>
Output:
Code:
<form>
<input type="file" value="Upload File">
</form>
Output:
Code:
<form>
<input type="submit" value="Submit">
<input type="reset" value="Reset">
<input type="button" value="Normal Button">
</form>
HTML forms are essential for interactive websites. By combining different input types, developers can collect structured data efficiently and improve user experience.