CC# Form Field Validation

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
Markian
Forum Newbie
Posts: 6
Joined: Mon Aug 18, 2003 4:00 pm
Location: Denver, Colorado

CC# Form Field Validation

Post by Markian »

I'm looking to validate there are 16 (or whatever) digits entered by the client into a form field (credit card). I'm not looking to verify the customer's account (there's PayPal for that). If it's not too fancy, maybe check to see if the beginning digit is correct for the appropriate credit card too. Any help is much appreciated.
jason
Site Admin
Posts: 1767
Joined: Thu Apr 18, 2002 3:14 pm
Location: Montreal, CA
Contact:

Post by jason »

You want to use the luhn algo.

You can see more information here:

http://www.zend.com/codex.php?id=31&single=1
m3rajk
DevNet Resident
Posts: 1191
Joined: Mon Jun 02, 2003 3:37 pm

Post by m3rajk »

is luhn the one that validates the first part and can tell you which type of card (and in some cases which bank issued it) tha the person is using?
Markian
Forum Newbie
Posts: 6
Joined: Mon Aug 18, 2003 4:00 pm
Location: Denver, Colorado

Post by Markian »

Thanks for the info!
Post Reply