Date: 08/08/06 (Web Development) Keywords: php, database, java So I've been relying primarily on PHP's preg_match for 100% of my form validation. Now I'm beginning to suspect it would be much cleaner to have JavaScript handle most of that (check for blank/empty inputs, or reject inappropriate characters/patterns) and simply leave the database checking for PHP (right or wrong login info, etc). Then I can have PHP handle all that stuff with AJAX-stuff, but not let bad input data even get out to the server in the first place. Of course, there's the local overhead a user will have to deal with, and slightly larger JavaScript file to load, but I could probably finagle it so it had all the regex script in a seperate file that it looks at when it needs it.
|