RE: [PEAR] QuickForm - Validate username with mysql
| From: | Mike Carter | Date: | Sun, 02 May 2004 22:38:49 +0000 |
| Subject: | RE: [PEAR] QuickForm - Validate username with mysql | ||
| References: | 1 | Groups: | php.pear.general |
| Request: | Send a blank email to pear-general+get-12273@lists.php.net to get a copy of this message | ||
> -----Original Message-----
> From: T. H. Grejc [mailto:php@1203.qwe.uni.cc]
>
> I'm trying to build user registration form with pear
> QuickForm. How can
> I validate if username is allready registered before adding
> it to database?
Add a formrule which can call your custom rule method. The method would do a
select on your database for the username entered in the form. If more than
zero rows are returned. Set an error message and return false. This will
cause Quickform to not proceed, and instead display the error.
This will happen on the server side.
If the username is not found already in the database, then your form will
continue its valiadation (if any more) and then proceed to processing your
forms data (adding it as a new entry in to the database).
Regards,
Mike C.
______________________________________________________________________
This email has been scanned by the MessageLabs Email Security System.
For more information please visit http://www.messagelabs.com/email
______________________________________________________________________