HTML Form Validation
What is Validation?
Validation ensures user inputs are correct before submitting form.
Example
<form method="post"> <input type="text" name="name" placeholder="Enter name" required minlength="3"><br><br> <input type="email" name="email" placeholder="Enter email" required><br><br> <button type="submit">Submit</button> </form>
Live Result (PHP Validation)
required
Field must be filled
minlength
Minimum characters
pattern
Regex validation
Summary
- Validation checks user input
- Prevents wrong data submission
- Can be done using HTML + PHP