it continuously calls the in Not Empty method until it returns a value of true or if the conditional fails for that field it will return false.Give this a shot and let me know if it helps or if you have any questions.We will also do two more things when the user submits the form: The next step is to create a function that will do all the checking for us (which is much more convenient than writing the same code over and over again). Now, we can check each $_POST variable with the test_input() function, and the script looks like this: Notice that at the start of the script, we check whether the form has been submitted using $_SERVER["REQUEST_METHOD"].If the REQUEST_METHOD is POST, then the form has been submitted - and it should be validated.
If you have such a form on your site, I'm sure that from time to time, you would have received the results of your form with some essential field (like the email address or the visitor's name, or even the feedback itself) omitted. One way around it is to validate the essential fields with a simple Java Script.Note: You do not need to do the things mentioned in this article if you have created your feedback form using the Feedback Form Script Wizard.Among other things, the script made by the wizard automatically checks for empty fields.of course you can write additional custom methods to validate numbers only, email address, valid URL, etc.If you use j Query at all I would look into trying out the j Query Validation plug-in. You can create a set and then set the values of the text and field colors to change to red when there is an error and then set it back to the defaults when the field validates.i just noticed the reason why i was getting the error alert, the field Data is compared with field Data which is obviously true always instead i need a function to verify that entered field is not the default value in text input.
Email validation checks the following points Figure 2: Above two figures are example of valid and invalid emails.