Storing last 4 digits

rhapsody 08 May, 2009
Hi,

How can I only save the last 4 digits of a credit card.

Thanks!
nml375 08 May, 2009
Use the substr command to select the last 4 digits:
$lastFour = substr($ccn, -4);


If you'd like to store this in the database, add a hidden field to your form, and add something like this in the "on Submit (before email)" code box:
JRequest::setVar('lastfour', substr(JRequest::getVar('creditcard', '', 'post'), -4);

This example assumes the creditcard is entered into a field named "creditcard", and the hidden field is named "lastfour".

/Fredrik
This topic is locked and no more replies can be posted.