Javascript validation and PHP validation?
I am using jquery validation plugin for validation empty forms. Should I also check this in PHP to be sure on 100%? Or it is ok开发者_C百科 with javascript validation. Thanks
You should always do your validation on the server.
What happens if a user submits the form in some way not using Javascript? Then all of the JS validation is null and void. Never trust Javascript alone. It's a very nice tool to use to make the site look slick, etc, but you can't assume the user will use it, even if you set it up that you aren't letting them submit normally.
When I personally put client and server side validation up, I work them to be the exact same validations. That way, the user typically doesn't see the server validation, but if something goes wrong, the information is still validated a much as necessary.
Users can disable javascript wich would bypass all your checking. For this reason you should always check input with php. Validating with javascript is mostly to make use of fancy ajax and jquery visuals. The real validation is always serverside.
javascript is executed by the client, so it is easily fooled. ALWAYS use server side validation as well.
精彩评论