URL: http://www.uburst.com/cgi-bin/dcforum/dcboard.cgi
Forum: ushp_general_purpose
Thread Number: 400
[ Go back to previous page ]

Original Message
"Credit card form"

Posted by dave on at 08:33 AM
Using u-shop 3.50, the standard credit card form.
In the credit card form.
We have been asking the customer to enter the credit card number with a - dash between each set of four numbers the same way it is shown on the card. Most do not seem to want to do this. I agree, I should not be asking them to enter it any special way. Is there a way to make that one field be split in to four, such as, [4444] [4444] [4444] [4444], so that they can type it in without having to enter a dash or space, although, have the field or (form information) be sent to me with a dash or at least a space between four numbers. I am either getting old or it is just hard to read 16 numbers all together with no spaces. Any ideas on this?

Thank you.


Table of contents

Messages in this discussion
"RE: Credit card form"
Posted by Bill Weiner on at 07:50 AM
Below is a way to modify the ushop.pl script such that it stores the credit card number with dashes every four digits:

STEP 1: Make a backup of your ushop.pl script... just in case.

STEP 2: Open your ushop.pl script with any text editor such as WordPad.

STEP 3: Do a search on the following line:

&validate_credit_card_parameters();

STEP 4: Immediately AFTER that line, add these 8 lines:

if (!($cc_number =~ /-/))
{
$formatted_cc = substr($cc_number,0,4) . "-";
$formatted_cc .= substr($cc_number,4,4) . "-";
$formatted_cc .= substr($cc_number,8,4) . "-";
$formatted_cc .= substr($cc_number,12,4);
$cc_number = $formatted_cc;
}

STEP 5: Save the script...as TEXT if your editor asks... and try it out!


"Credit card form"
Posted by dave on at 12:57 PM
Thank you, that worked slicker than, um, water on ice.
I must say that the customer support here is the best I have seen. How many companies will take the time to write a customer out a special script or take the time to show them something they should learn on their own.

Thanks again


"RE: Credit card form"
Posted by Bill Weiner on at 06:20 AM
Glad that worked for you :^)

"Credit Card Form"
Posted by Ron Harter [rgharter@pacbell.net] on at 06:45 PM
Bill,
This works fine if they use no spaces or use a dash (-) between the 4 digits but if they enter a space i.e 4111 1111 1111 1111 it comes out as 4111- 111-1 11-11 1 and drops the last 3 digits. Any way to handle this? I have "no spaces" next to the number entry box but many do it anyway.
Thanks
Ron

"RE: Credit Card Form"
Posted by Bill Weiner on at 06:28 AM
Directly BEFORE the modification described above, you could add a line like this to remove any spaces from the credit card number:

$cc_number =~ s/ //g;

So the IMPROVED modification would actually look like this:

STEP 1: Make a backup of your ushop.pl script... just in case.

STEP 2: Open your ushop.pl script with any text editor such as WordPad.

STEP 3: Do a search on the following line:

&validate_credit_card_parameters();

STEP 4: Immediately AFTER that line, add these 9 lines:

$cc_number =~ s/ //g;
if (!($cc_number =~ /-/))
{
$formatted_cc = substr($cc_number,0,4) . "-";
$formatted_cc .= substr($cc_number,4,4) . "-";
$formatted_cc .= substr($cc_number,8,4) . "-";
$formatted_cc .= substr($cc_number,12,4);
$cc_number = $formatted_cc;
}

STEP 5: Save the script...as TEXT if your editor asks... and try it out!