Welcome Guest, Not a member yet? Register   Sign In
Error when validating credit card with multiple parameters in valid_cc_number rule
#1

(This post was last modified: 06-03-2021, 03:38 PM by funcion.)

I am using the codeigniter valid_cc_number credit card validation rule following the documentation https://codeigniter.com/user_guide/libra...able-rules

It works when I add a card type: valid_cc_number[visa]

PHP Code:
$validation = \Config\Services::validation();
$validation->setRules(['card_number' => 'required|valid_cc_number[visa]']); 

If I specify more than one card type like this: valid_cc_number[visa,mastercard]

PHP Code:
$validation = \Config\Services::validation();
$validation->setRules(['card_number' => 'required|valid_cc_number[visa,mastercard]']); 

Quote:It shows me the following message: Validation.valid_cc_number

How can I validate the credit card number specifying more than one type of card as in the valid_cc_number rule?

Credit card types: amex, unionpay, carteblanche, dinersclub, discover, interpayment, jcb, maestro, dankort, mir, troy, mastercard, visa, uatp, verve, cibc, rbc, tdtrust, scotia, bmoabm, hsbc

Sample credit card numbers: https://www.paypalobjects.com/en_AU/vhel...umbers.htm

American Express: 378282246310005
Diners Club: 30569309025904
MasterCard: 5555555555554444
Visa: 4111111111111111
Reply


Messages In This Thread
Error when validating credit card with multiple parameters in valid_cc_number rule - by funcion - 06-03-2021, 02:51 PM



Theme © iAndrew 2016 - Forum software by © MyBB