Page 1 of 1

help

Posted: Sat Apr 18, 2009 5:32 pm
by p_sha85
Okay I have the following code and I keep getting errors.. I don't know why. I have doublechecked it so many times and it looks right to me but I don't know what is wrong. If anyone can please help me out with this and show me what I'm doing wrong I would reeaalllyyy appreciate it. Thanks!!

Code:

Code: Select all

 
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN""http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>Validate Credit Card</title>
<meta http-equiv="content-type" content="text/html; charset=iso-8859-1" />
</head>
<body>
<h1>Validate Credit Card</h1><hr />
<form action="ValidateCreditCard.php" method="get"
enctype="application/x-www-form-urlencoded">
<p><input type="text" name="ccnumber" size="20" value="<?php 
if (!empty($_GET['ccnumber'])) echo $_GET['ccnumber'] 
if (!isset($_GET['ccnumber']))
      echo "<p>Enter your credit card number.</p>";
else {
     $Payment = $_GET['ccnumber'];
     $ValidPayment = str_replace("-", "", $Payment);
     $ValidPayment = str_replace(" ", "", $ValidPayment);
     if (!is_numeric($ValidPayment))
      echo "<p>You did not enter a valid credit card number!</p>";
     else 
      echo "<p>Your credit card number is $ValidPayment.</p>";
}
?>" /></p>
<p><input type="submit" value="Validate Credit Card" /></p>
</form><hr />
</body>
</html>
 

Re: help

Posted: Sun Apr 19, 2009 9:03 am
by Reviresco
Missing semicolon at end of line 13.

Also, don't put paragraph <p> tags inside of a text input, and for good form, use brackets for your if and else statements.