Trizen Posted November 19, 2009 Share Posted November 19, 2009 ok im curious why some people want to make they PHP do the validation when they can do it with Javascript and it will make your code less bulky and your site faster. cause i under the impression less communication with the server and more client side= faster. Im just curious. Quote Link to comment https://forums.phpfreaks.com/topic/182139-dependent-on-server-side/ Share on other sites More sharing options...
Alex Posted November 19, 2009 Share Posted November 19, 2009 The bottom line is that JavaScript can be disabled. Although JavaScript validation is often a nice touch, there should always be server-side validation in place just in case. Quote Link to comment https://forums.phpfreaks.com/topic/182139-dependent-on-server-side/#findComment-960933 Share on other sites More sharing options...
Trizen Posted November 19, 2009 Author Share Posted November 19, 2009 can you just detect if javascript is disabled and instead of doing validation on the app you just have it validate if javascript is working and if not redirect them to a page that says they cant view or use the site without it to reduce the amount of communication? Quote Link to comment https://forums.phpfreaks.com/topic/182139-dependent-on-server-side/#findComment-960937 Share on other sites More sharing options...
Alex Posted November 19, 2009 Share Posted November 19, 2009 That's not a good idea either, because JavaScript can be easily edited. It's not really an issue of communication, when the form is submitted there's only 1 request to the server, and one response. The amount of time that some quick PHP validation will take is insignificant. Quote Link to comment https://forums.phpfreaks.com/topic/182139-dependent-on-server-side/#findComment-960940 Share on other sites More sharing options...
PFMaBiSmAd Posted November 19, 2009 Share Posted November 19, 2009 ALL external data (post/files/get/cookie) cannot be trusted and must be validated on the server. There is no guarantee that YOUR form or any form at all was used to submit data to your form processing code. Quote Link to comment https://forums.phpfreaks.com/topic/182139-dependent-on-server-side/#findComment-960957 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.