ivanhalen
asked on
Looking for a comprehensive PHP form validation class
Hello,
Please can you suggest me a comprehensive PHP form validator class? I'm searching for something powerful and easy to use with the following validation features:
Alphanumeric (uppercase, lowercase, numbers, spaces, special chars and a mix of them)
Credit Card number (most used CC: Visa, Mastercard, etc.)
Date / Time (min/max date, min/max time; date and time format choice)
E-mail address
Entry length (min/max length)
FIle extension
Like entry (compare two fields, as in password confirm)
Number (decimal separator [dot or comma], min/max, # of decimals allowed)
Required (the field can't be blank)
URL (protocols allowed or ignored)
Zip code (5 digits, 9 digits, etc.)
Seems impossible to have all these features in one class, uh?
Please can you suggest me a comprehensive PHP form validator class? I'm searching for something powerful and easy to use with the following validation features:
Alphanumeric (uppercase, lowercase, numbers, spaces, special chars and a mix of them)
Credit Card number (most used CC: Visa, Mastercard, etc.)
Date / Time (min/max date, min/max time; date and time format choice)
E-mail address
Entry length (min/max length)
FIle extension
Like entry (compare two fields, as in password confirm)
Number (decimal separator [dot or comma], min/max, # of decimals allowed)
Required (the field can't be blank)
URL (protocols allowed or ignored)
Zip code (5 digits, 9 digits, etc.)
Seems impossible to have all these features in one class, uh?
Simple solution for your problem:
http://pear.php.net/Validate/
Tutorial link:
http://pear.php.net/support/tutorials.php
http://www.tutorialized.com/tutorials/PHP/PEAR/1
Hope this helps.
Addy
http://pear.php.net/Validate/
Tutorial link:
http://pear.php.net/support/tutorials.php
http://www.tutorialized.com/tutorials/PHP/PEAR/1
Hope this helps.
Addy
ASKER
Ops! Addy, I forgot to mention that I'll be on a shared host: can I still use PEAR if I have no way to install it?
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Yes, seems that it works even without installation... but the script is excellent on few things and cuts off other useful validations...
I.e., there are a lot of methods to validate TLDs in different ways, but there are no validations for credit card, entry length, file extension, compare fields, zip... :-(
I must admit, all the validations I'm searching for are yet included in a Dreamweaver extension I purchased some years ago... But I'm trying to leave Dreamweaver to rely on hand-coding to avoid junk, but since I'm a PHP newbie I have no idea how to "convert" that long script in a easy-to-use class...
Anyway, the PEAR worked and I'm happy to know a thing more :-)
I.e., there are a lot of methods to validate TLDs in different ways, but there are no validations for credit card, entry length, file extension, compare fields, zip... :-(
I must admit, all the validations I'm searching for are yet included in a Dreamweaver extension I purchased some years ago... But I'm trying to leave Dreamweaver to rely on hand-coding to avoid junk, but since I'm a PHP newbie I have no idea how to "convert" that long script in a easy-to-use class...
Anyway, the PEAR worked and I'm happy to know a thing more :-)
Can you check the following code and let me know.....
Thanks
Open in new window