This site uses cookies. By continuing, your consent is assumed. Learn more

97.3fm shares

Validating user input using php javascript

opinion

By using our site, you acknowledge that you have read and understand our Cookie PolicyPrivacy Policyand our Terms of Service.

HTML form validation can be...

I have set up a basic contact form which emails the form data via PHP. This works fine but I am having trouble intregrating validation script into the code to prevent the form from submitting when no data is entered. I have tried integrating the below validation script but this doesn't prevent the form from submitting?

Aside of your validation in the client you really have to do the validation on the server side all over in PHP. There is NO guarantee whatsoever that the client side validation happens users might even have disabled javascript completelynor that the input comes from your page at all.

News feed