SCENARIO:

You're filling out your online web form.  Unfortunately, you forgot to 
fill out/check/select some data or other that is considered "required" 
by the site that's hosting the form.  You hit "submit", but you are 
simply returned to the same page.  All of the data that you entered is 
still there, but the fields which you accidentally left blank are marked 
with a big red asterisk.

QUESTION:

There's plenty of ways to achieve this effect.  One way, that I have 
been using, is a page that calls itself and executes different code (via 
a switch statement) depending on what the user does with a form.  Using 
hidden form fields and the like.  In each "section" of the switch 
statement, the code is checked for the presence of certain variables -- 
if they are not present, then the statement "break"s, and the default 
"section" of the switch statement requires the user to fill out the 
required fields again.

Is there a standard algorithm that is used by most PHP developers "in 
the know" for this?  Or does everybody pretty much write the code that 
comes to their mind and which is most appropriate to their application?

I can write this code myself -- but I write pretty sloppy code and was 
wondering if there is a neat, encapsulated algorithm that a lot of 
people use because its effectiveness has been proven time and again.  If 
not, no worries, I look forward to writing it as best I can.



Erik





----

Erik Price
Web Developer Temp
Media Lab, H.H. Brown
[EMAIL PROTECTED]


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]

Reply via email to