PHP card number validation

Hi All

Want to validate a card number from a submitted form field…

Done some searching and found this

http://www.braemoor.co.uk/software/creditcard.php

However i cannot figure out

  1. how to call it from the submitted form.
  2. what output i get from it.

has anyone used it before, or is there another ‘better’ script…

many thanks
steve

The script returns a boolean value of true or false based on the credit card number / credit card type combo you provide it. So for a form you could do something like this…


// Check for form submission
if($_POST['myformsubmitted']) {
 // Use the checkCreditCard function to validate the credit card number
 if(checkCreditCard($_POST['ccnumber'], "Visa", $ccerror, $ccerrortext)) {
  // Returned true (success)
  echo "Success!";
 }
 // Returned false
 else {
  echo "Validation failed!";
 }
}