HTML Forms
HTML forms are used to collect user input. They contain various input elements like text fields, checkboxes, and buttons.
Form Example
<form action="/submit" method="post">
<label for="name">Name:</label>
<input type="text" id="name" name="name"><br>
<label for="email">Email:</label>
<input type="email" id="email" name="email"><br>
<label for="password">Password:</label>
<input type="password" id="password" name="password"><br>
<label for="gender">Gender:</label>
<input type="radio" id="male" name="gender" value="male"> Male
<input type="radio" id="female" name="gender" value="female"> Female<br>
<label for="hobbies">Hobbies:</label>
<input type="checkbox" id="reading" name="hobbies" value="reading"> Reading
<input type="checkbox" id="sports" name="hobbies" value="sports"> Sports<br>
<label for="country">Country:</label>
<select id="country" name="country">
<option value="usa">USA</option>
<option value="canada">Canada</option>
<option value="uk">UK</option>
</select><br>
<label for="message">Message:</label>
<textarea id="message" name="message" rows="4" cols="50"></textarea><br>
<input type="submit" value="Submit">
</form>
Form Input Types
<input type="text">
: Single-line text input<input type="password">
: Password input<input type="email">
: Email input<input type="radio">
: Radio button<input type="checkbox">
: Checkbox<select>
: Dropdown list<textarea>
: Multi-line text input<input type="submit">
: Submit button