Computer Science : Web Development Exercise 3-1
Complete the weekly labs based on the following:
In this project, you will create a script that validates whether
a credit card number contains only integers. Th e script will
remove dashes and spaces from the string. After the dashes and
spaces are removed,the script should reject the credit card number
if it contains any other non-numeric characters.
else
echo “
Credit Card Number ” .
$CreditCardNumber . ” is a valid
Credit Card number.
“;
}
}
8. Save the document as ValidateCreditCard.php in the Projects
directory for Chapter 3 and upload the fi le to the server.
9. Open ValidateCreditCard.php in your Web browser by enter-ing
the following URL:
http://
Test the script to see if it displays a message for an empty
string, strips dashes and spaces from the credit card numbers, and
identifies which credit cardnumbers are valid.