adam84 Posted August 1, 2008 Share Posted August 1, 2008 I know totally different, but I just wanted to know if I do all my data validation after my form has been submitted is that considered to be good coding or should I do the validation first in javascript, then recheck everything in PHP. As of now, I am just doing everything in PHP because in a few past posts, people have said to validate the data in PHP because Javascript can be turned off. So if a user can turn their Javascript off, is it even worth validating in Javascript at all? Thanks Quote Link to comment https://forums.phpfreaks.com/topic/117746-solved-php-vs-javascript/ Share on other sites More sharing options...
GingerRobot Posted August 1, 2008 Share Posted August 1, 2008 1.) Always validate server side. 2.) Add validation client side so that it is more user friendly. It is far nicer for the user to be told immediately that their username is not long enough than to fill out the rest of the form, wait a while, then be told. Not to mention lighter load on your server. Quote Link to comment https://forums.phpfreaks.com/topic/117746-solved-php-vs-javascript/#findComment-605616 Share on other sites More sharing options...
LemonInflux Posted August 1, 2008 Share Posted August 1, 2008 Javascript validation is a huge security risk, because it doesn't mean anything. You can use javascript injection to get past it, or even firefox's firebug addon :/ Quote Link to comment https://forums.phpfreaks.com/topic/117746-solved-php-vs-javascript/#findComment-605625 Share on other sites More sharing options...
JD* Posted August 1, 2008 Share Posted August 1, 2008 As GingerRobot said, it's good to have the checking in there. Personally, I only validate via PHP, but I build my scripts to refill the form with previously submitted data to help ease the burden for having to fill out everything again. Quote Link to comment https://forums.phpfreaks.com/topic/117746-solved-php-vs-javascript/#findComment-605633 Share on other sites More sharing options...
adam84 Posted August 1, 2008 Author Share Posted August 1, 2008 Awesome thanks! Quote Link to comment https://forums.phpfreaks.com/topic/117746-solved-php-vs-javascript/#findComment-605636 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.