By bonlebon
via phphacks.com
Published: Sep 14 2006 / 05:00
Here is a simple, quick way to validate required form fields using AJAX, PHP and MySQL. What we’re going to do is display an error message to the right of the required field, and if there are errors, restrict the submit button. And if a user were to skip a required field, or leave it blank, we’ll highlight it along with removing the submit button.



Comments
ancestor replied ago:
As suggested in the article, never forget to filter $_REQUEST variables that might be passed to the database. See PHP's mysql_real_escape_string() manual for some examples http://pt.php.net/manual/en/function.mysql-real-escape-string.php
ashiro replied ago:
I've found Dojo's form validation widget to be far superior to anything this article offers although its good as a learning tool for rolling your own validation system.
Voters For This Link (12)
Voters Against This Link (0)