I have this form. The problem I'm having is that I keep getting an Error if the form element "Card Type:" (the list/menu item) is named anything other than "select".
The section of code in question is contained within the *************.
<?php echo "<?xml version=\"1.0\" encoding=\"iso-8859-1\"?".">"; ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>Test Form</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
</head>
<body>
<form name="form1" id="form1" method="post" action="testconfirm.php">
<p align="center"><strong></strong></p>
<hr />
<div align="center"><font size="+2"><strong>Personal Information</strong></font>
</div>
<p>First Name & Middle Initial:
<input type="text" name="txtFirstName" />
Last Name:
<input type="text" name="txtLastName" />
</p>
<p>Phone Number:
<input type="text" name="txtPhoneNumber" />
Street:
<input type="text" name="txtStreet" />
City:
<input type="text" name="txtCity" />
</p>
<p>State:
<input type="text" name="txtState" />
Zipcode:
<input type="text" name="txtZipcode" />
</p>
<p align="center"><font color="#FF0000">(The address information here will be
recorded as the Billing Address.</font> ) </p>
<hr />
<div align="center"><font size="+2"><strong>Credit Card Information</strong></font>
</div>
***************************************
<p>Card Type
<select name="select">
<option>Visa</option>
<option>Mastercard</option>
<option>American Express</option>
</select>
***************************************
Card #:
<input type="text" name="txtCardNumber" />
Expiration Date:
<input type="text" name="txtCardExpDate" />
</p>
<p>Exact Name on Card:
<input type="text" name="textfield8" />
<strong><font size="+2"><br />
</font></strong></p>
<hr />
<div align="center">
<p><strong><font size="+2">Shipping Information</font></strong></p>
<p>
<input type="checkbox" name="checkbox" value="checkbox" />
<font color="#FF0000"> Check this box if your shipping address is different
than that indicated above.</font> </p>
</div>
<p>Street:
<input type="text" name="textfield22" />
City:
<input type="text" name="textfield42" />
State:
<input type="text" name="textfield32" />
Zipcode:
<input type="text" name="textfield52" />
</p>
<p>
<input type="submit" name="Submit" value="Submit" />
<input type="reset" name="Submit2" value="Reset" />
</p>
</form>
</body>
</html>
This is the PHP page. I'm trying to put the values of the form into variables.
<?php echo "<?xml version=\"1.0\" encoding=\"iso-8859-1\"?".">"; ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>Test Confirmation</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
</head>
<body>
<?php
$FirstName = $_POST['txtFirstName'];
$LastName = $_POST['txtLastName'];
$PhoneNumber = $_POST['txtPhoneNumber'];
$PerStreet = $_POST['txtStreet'];
$PerCity = $_POST['txtCity'];
$PerZip = $_POST['txtZipcode'];
***************************************
$CardType = $_POST['select'];
***************************************
print ("Bill to: " . $FirstName . " " . $LastName . "<br />");
print ("Phone Number: " . $PhoneNumber . "<br />");
print ("Billing Address: " . $PerStreet . ", " . $PerCity . " " . $PerZip . "<br />");
print ("Credit Card Information: " . $CardType . "<br />");
?>
</body>
</html>Originally posted by AndrewAK
I have this form. The problem I'm having is that I keep getting an Error if the form element "Card Type:" (the list/menu item) is named anything other than "select".
***************************************
<p>Card Type
<select name="select">
<option>Visa</option>
<option>Mastercard</option>
<option>American Express</option>
</select>
***************************************
***************************************
$CardType = $_POST['select'];
***************************************
You should be able to change it, as long as BOTH the red areas are exactly the same (Case Sensitive), and contain no spaces.You were correct, I must have had an extrainious character somewhere in my code. It works fine now. Thanks for the heads-up.I just had the same problem and spent forever on it. Then I found out the name I was using was defined twice in the same script. DOH!
The section of code in question is contained within the *************.
<?php echo "<?xml version=\"1.0\" encoding=\"iso-8859-1\"?".">"; ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>Test Form</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
</head>
<body>
<form name="form1" id="form1" method="post" action="testconfirm.php">
<p align="center"><strong></strong></p>
<hr />
<div align="center"><font size="+2"><strong>Personal Information</strong></font>
</div>
<p>First Name & Middle Initial:
<input type="text" name="txtFirstName" />
Last Name:
<input type="text" name="txtLastName" />
</p>
<p>Phone Number:
<input type="text" name="txtPhoneNumber" />
Street:
<input type="text" name="txtStreet" />
City:
<input type="text" name="txtCity" />
</p>
<p>State:
<input type="text" name="txtState" />
Zipcode:
<input type="text" name="txtZipcode" />
</p>
<p align="center"><font color="#FF0000">(The address information here will be
recorded as the Billing Address.</font> ) </p>
<hr />
<div align="center"><font size="+2"><strong>Credit Card Information</strong></font>
</div>
***************************************
<p>Card Type
<select name="select">
<option>Visa</option>
<option>Mastercard</option>
<option>American Express</option>
</select>
***************************************
Card #:
<input type="text" name="txtCardNumber" />
Expiration Date:
<input type="text" name="txtCardExpDate" />
</p>
<p>Exact Name on Card:
<input type="text" name="textfield8" />
<strong><font size="+2"><br />
</font></strong></p>
<hr />
<div align="center">
<p><strong><font size="+2">Shipping Information</font></strong></p>
<p>
<input type="checkbox" name="checkbox" value="checkbox" />
<font color="#FF0000"> Check this box if your shipping address is different
than that indicated above.</font> </p>
</div>
<p>Street:
<input type="text" name="textfield22" />
City:
<input type="text" name="textfield42" />
State:
<input type="text" name="textfield32" />
Zipcode:
<input type="text" name="textfield52" />
</p>
<p>
<input type="submit" name="Submit" value="Submit" />
<input type="reset" name="Submit2" value="Reset" />
</p>
</form>
</body>
</html>
This is the PHP page. I'm trying to put the values of the form into variables.
<?php echo "<?xml version=\"1.0\" encoding=\"iso-8859-1\"?".">"; ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>Test Confirmation</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
</head>
<body>
<?php
$FirstName = $_POST['txtFirstName'];
$LastName = $_POST['txtLastName'];
$PhoneNumber = $_POST['txtPhoneNumber'];
$PerStreet = $_POST['txtStreet'];
$PerCity = $_POST['txtCity'];
$PerZip = $_POST['txtZipcode'];
***************************************
$CardType = $_POST['select'];
***************************************
print ("Bill to: " . $FirstName . " " . $LastName . "<br />");
print ("Phone Number: " . $PhoneNumber . "<br />");
print ("Billing Address: " . $PerStreet . ", " . $PerCity . " " . $PerZip . "<br />");
print ("Credit Card Information: " . $CardType . "<br />");
?>
</body>
</html>Originally posted by AndrewAK
I have this form. The problem I'm having is that I keep getting an Error if the form element "Card Type:" (the list/menu item) is named anything other than "select".
***************************************
<p>Card Type
<select name="select">
<option>Visa</option>
<option>Mastercard</option>
<option>American Express</option>
</select>
***************************************
***************************************
$CardType = $_POST['select'];
***************************************
You should be able to change it, as long as BOTH the red areas are exactly the same (Case Sensitive), and contain no spaces.You were correct, I must have had an extrainious character somewhere in my code. It works fine now. Thanks for the heads-up.I just had the same problem and spent forever on it. Then I found out the name I was using was defined twice in the same script. DOH!