RE: Session and validation

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



[snip]
I had this thread going yesterday.  Then basically
think it reached a stalemate.  I'm wondering has
anyone setup forms using session variables and
validation.  Validation where the validating is done
on the same page, and the redirected on success ?
[/snip]

You need a class which will generate and validate your forms
dynamically.  Pear provides two packages (the second an extension of the
first):

http://pear.php.net/package/HTML_QuickForm
http://pear.php.net/package/HTML_QuickForm_Controller

I've never used these as I wrote my own library to handle this a few
years ago, but from what I understand these two packages will do the
trick.

Basically it will work thusly:

1)  On a page where you need a form, you declare a new form object,
specify all your inputs, how they should be validated, etc., and these
are then stored in the session.

2)  On the receiving page you call the form validation object, passing
in an identifier for which form should be validated.

3)  If it validates your script will continue unfettered, else it will
update the values in the session with the appropriate error message and
redirect you back to the original form, which, since you are using
session variables to display the inputs, will now be updated with the
error messages.

HTH,
Pablo

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux