Form Validation is a necessary process before the data entered in the form is submitted to the database.
<!DOCTYPE HTML> <html><head><style>.error {color: #FF0000;}</style></head><body><?php?><form method="post" action="<?php echo htmlspecialchars($_SERVER["PHP_SELF"]);?>"> Name: <input type="text" name="name" value="<?php echo $name;?>"> <span class="error">* <?php echo $nameErr;?></span> <br><br> Mobile: <input type="text" name="mobile" value="<?php echo $mobile;?>"> <span class="error">* <?php echo $mobileError;?></span> <br><br> E-mail: <input type="text" name="email" value="<?php echo $email;?>"> <span class="error">* <?php echo $emailError;?></span> <br><br> <input type="submit" name="submit" value="Submit"> </form></body></html>