Looking for more information on how to do PHP the right way? Check out PHP: The Right Way

John Cox's Blog:
Form Validation with AJAX/PHP
Jun 08, 2005 @ 10:55:56

Over on John Cox's blog today, he has this quick post discussing AJAX and Form Validation in PHP.

Where I am interested in AJAX is in the realm of form validation. Form validation is a necessary evil. It's not very usable for the user, and adds a ton of code to an otherwise sane function. In the same breath, we need to validate our forms to secure our backends, as well as take the variation out of our input. I would love to have a couple of places for lengthy validation such as role registration and profile updating for the elegance and usability.

Chris Campbell has written a pretty nice tutorial on a method for form validation with a graceful fallback for folks that have disabled JavaScript when browsing. ASP and PHP are both illustrated in the article.

The tutorial he links to is actually using ASP to get the backend work done, but it's super easy to adapt it to PHP with almost no effort. Besides, the important part is the AJAX code anyway...

tagged:

Link:


Trending Topics: