...

View Full Version : Javascript, PHP email to form, validation



kelisaid
06-18-2008, 07:58 PM
Alright,

no jokes now.. I'm new to this stuff, completely. So my question is this.

I'm working on our company website and we're running a survey that calls to action a PHP form to email script, what I want to do is validate the fields to make sure participants are filling them out and we're getting all the necessary information. I've tried javascript form validation but can not seem to get it to work. Do i need to validate with PHP, in the same .php file that we have our form to email script?

Any help would be appreciated.:thumbsup:

binaryWeapon
06-18-2008, 10:36 PM
You can use either javascript or php validation. PHP validation may be a little more secure, since if you had javascript validation someone could manually send the GET or POST variables to get around the validation. Normal users definitely wouldn't know how to do this, but theres a chance that a spammer might. Also if you're using something like a CAPTCHA to put off spammers, PHP validation is a necessity.

Philip M
06-19-2008, 10:22 AM
JavaScript form validation only provides convenience for users, not security. This means that JavaScript should be used as an "enhancement", not as a requirement. So your form should not be dependent on JavaScript alone to perform your validation. Instead, whatever server-side language you use to process the form (PERL, ASP, PHP, etc.) should also perform the same validation. Otherwise, people will be able to bypass your validation simply by disabling JavaScript.

kelisaid
06-20-2008, 09:50 PM
Well we run the script in PHP to email it after the form has been completed, so within that same script I can use another PHP script for validation? and it will run both of the requests? I'll try that.

Thanks!



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum