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

Evolt:
Making Friendly Forms in PHP
May 21, 2003 @ 12:07:46

For those out there that find forms and PHP a struggle lately, you might want to take a look at this new article from Evolt.org.

In this new shortish piece, Clever forms with PHP, the author shows you how, with a few simples lines of code, how to create forms that will have "required fields". This allows you to enforce form input on certain elements without having to worry about those silly empty default value="" results passed to your scripts. Once the form is submitted, it checks the values to see if any of them are empty and (with some matches and replaces) either highlights them, or replaces the value that was in it before.

It's a little confusing to see exactly what this script does when it comes to resubmitting the form, but once you get into the code and see how it's all working, it makes it a bit easier. Just be sure you don't see this as a "drop it in and it'll work" solution...

tagged:

Link:


Trending Topics: