PHP forums, MySQL forums, Web Development resources

Home PageHome    PHP ResourcesTopic List    FAQFAQ    SearchSearch    MemberlistMemberlist    UsergroupsUsergroups 
 RegisterRegister
    ProfileProfile    Log in to check your private messagesLog in to check your private messages    Download the RSS Reader RSS Feed Download the RSS Reader RSS for this forum Log inLog in 

PHP Forum :: MySQL Forum :: Java Script Forum



Adding dashes to credit card #

 
Post new topic   Reply to topic    WeberForums.com Forum Index -> PHP General
View previous topic :: View next topic  
Author Message
Swift Griggs
Guest





PostPosted: Sun Jan 24, 1999 8:58 pm    Post subject: Adding dashes to credit card # Reply with quote

The bank we use to validate our credit cards wants us to provide a paper format to validate the cards. This paper format must have credit card numbers separated by "-" every 4 digits. How can I do this? Seems like I'd need AWK or something.
Back to top
Boaz Yahav
Guest





PostPosted: Sun Jan 24, 1999 10:10 pm    Post subject: RE: Adding dashes to credit card # Reply with quote

You can use the next function. It's good for VISA cards but you can easily add cases for any other card :

<?
function AddDash($CC_Num,$CC_Type){
if ($CC_Type="VISA") {
$NewCC="";
for ($i=0 ; $i < 4 ; $i++)
$NewCC=$NewCC.substr($CC_Num, ($i*4), 4)."-";
}
$NewCC=substr($NewCC,0,19);
return ($NewCC);
}
?>
Back to top
Swift Griggs
Guest





PostPosted: Sun Jan 24, 1999 11:43 pm    Post subject: RE: Adding dashes THANX Reply with quote

Cool, that's exactly what I was looking for!
Back to top
Boaz Yahav
Guest





PostPosted: Sun Jan 24, 1999 11:48 pm    Post subject: RE: Adding dashes THANX Reply with quote

No problem...

Thats what the forum is for Smile
Back to top
今之中今
Guest





PostPosted: Fri Feb 26, 1999 10:57 am    Post subject: RE: Adding dashes THANX Reply with quote

中之今中之今
Back to top
Display posts from previous:   
WeberTrivia Questions WeberTrivia Questions
 Think you are smart? Prove it!. Try your skills with these questions :
 WeberTrivia QuestionsRecursive arrays and multi-dimensional arrays are one and the same. (PHP and MySQL)
 WeberTrivia QuestionsThe \"cache_dir\" tag of the squid configuration has a default of /var/spool/squid. (Linux)

WeberTrivia Questions



PHP Code Examples
 Stream diffrent sizes of images from a single image to save disk space.
 JavaScript dropdown list menu to switch any page.
 Dump the contents of a PHP variable in html format with a recursive list of subfolders and files from a given root directory.
 PHP Dump in html format the contents of one array variable with a recursive list of the nested array variables inside.
 Link Extractor - This function is used to extract links from a given URL. This will convert relative path into absolute path and also remove PHPSESSID stuff.
 Building a Dynamic Form using Javascript and innerHTML. Add form elements in realtime without refreshing the page.
 A PHP Calendar function with CSS : add a cool calendar to any php page by just adding a calendar class based function.
Post new topic   Reply to topic    WeberForums.com Forum Index -> PHP General All times are GMT + 2 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum






Powered by phpBB © 2001, 2005 phpBB Group
PHP Forum :: MySQL Forum :: Java Script Forum