HTML Forms
Forms allow users to input data that can be sent to a server for processing.
Basic Form Structure
<form action="/submit" method="POST">
<label for="name">Name:</label>
<input type="text" id="name" name="name">
<label for="email">Email:</label>
<input type="email" id="email" name="email">
<button type="submit">Submit</button>
</form>Input Types
text- Single line textemail- Email with validationpassword- Hidden inputnumber- Numeric inputdate- Date pickercheckbox- Multiple selectionsradio- Single selection
Form Validation
<input required> <!-- Field is required -->
<input minlength="3"> <!-- Minimum characters -->
<input pattern="[A-Z]+"> <!-- Regex pattern -->