I only want that error to display if they have pressed the register button and still have a blank field. field is a textarea. $emailErr = "valid Email address"; $email = test_input($_POST["email"]); // check if e-mail address is well-formed, if (!filter_var($email, FILTER_VALIDATE_EMAIL)) {. Making statements based on opinion; back them up with references or personal experience. The following code will create a form with the fields mentioned above and also validate the form.. I have the following form that needs to feed into the database but I would like it to be validated before it can be saved into the database : And the submit is done by a jquery script using the following script : How can I put form validation to check if input is empty before submitting it into the script? On Second part is about validating email addresses with PHP. To subscribe to this RSS feed, copy and paste this URL into your RSS reader. To validate data at the client side, you can use HTML5 validation or JavaScript. It does not store any personal data. The other fields will be empty with an error message next to them. If you want to report an error, or if you want to make a suggestion, do not hesitate to send us an e-mail: