PHP Contact Form with Javascript and PHP Form Validation
Monday, February 26th, 2007I've recently melded a few things together to create a better contact form with two types of validation. Pre-validation occurs with javascript as the user enters data so users have an indication that they have input invalid data. The second validation occurs via PHP on submission of the form. You can check it out here: http://www.minc.info/formtest/
I used the FormProcessor.class.php file from Simon Willison's excellent "Easier form validation with PHP" script which I modified slightly (modified file available here: http://www.minc.info/formtest/FormProcessor.class.phps). The javascript validation is done using a modified version of Stephen Poley's excellent Javascript form validation script: http://www.xs4all.nl/~sbpoley/webmatters/formval.html. The modified version is available here: http://www.minc.info/formtest/formval.js . And of course, the php file that runs everything can be viewed here: http://www.minc.info/formtest/index.phps