Jump to content

Recommended Posts

I have creating a contact form with validation. but i have no idea to validate the contact form which platform. anybody having new idea to validate the contact form pls reply. otherwise tell any good PHP Training Institutes? My friends are recommending this PHP Training Institute

Don't validate anything with JavaScript what you can validate with PHP. Just don't.

 

Edit: ... Of course, I'm implying that your JavaScript implemntation is not found on your server. If it was a server-side implementation of JS, then go ahead. If you mean the client-side JS with the Document Object Model, then forget about it.

Edited by Irate

Don't validate anything with JavaScript what you can validate with PHP. Just don't.

 

Edit: ... Of course, I'm implying that your JavaScript implemntation is not found on your server. If it was a server-side implementation of JS, then go ahead. If you mean the client-side JS with the Document Object Model, then forget about it.

 

I think he means checking if the user actually input anything in the field when they press submit. If they didn't input anything it shows an error message on top of that field. This would be done with JavaScript, not PHP.

I distribute a contact form with jquery, ajax and php validation methods along with HTML5 attributes for certain browser validation.

You can take some clues from it if you want, or use it if you also want.

http://amecms.com/article/Easy-to-use-contact-form-with-validation

I think he means checking if the user actually input anything in the field when they press submit. If they didn't input anything it shows an error message on top of that field. This would be done with JavaScript, not PHP.

 

This can be accomplished with PHP. You would just re-display the form if there were errors, populate it with the information submitted, and display the necessary error notices.

 

The only benefit of using a client-side solution, like JavaScript, is that the page doesn't need to be reloaded before the errors are displayed. JavaScript could display the errors on the fly. Just be aware that JavaScript can be turned off, so it's a good idea to also validate using a server-side solution like PHP.

This can be accomplished with PHP. You would just re-display the form if there were errors, populate it with the information submitted, and display the necessary error notices.

 

The only benefit of using a client-side solution, like JavaScript, is that the page doesn't need to be reloaded before the errors are displayed. JavaScript could display the errors on the fly. Just be aware that JavaScript can be turned off, so it's a good idea to also validate using a server-side solution like PHP.

 

Yes but its always good to be double-careful ;) Plus if you don't use JS than it isn't very interactive and it keeps it basic.

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.