what is wrong with this PHP code check boxes? reask?

upyr1

New member
I have two pages of code they are suppsoed to accept check box in put-
an item and a price on the HTML then the PHP prints a total
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<title>Untitled Document</title>
</head>

<h1>Check box demo</h1>
<h3>Demostrates check boxes</h3>
The checkboxes are used for input
<form action="checkdemo.php">
<h3>What do you want with your order</h3>
<ul>
<li>
<input type="checkbox"
name="fries"
value="1.25">fries
</li>
<li>
<input type="checkbox"
name ="soda"
value="2.50">soda
</li>
<li>


<input type = "submit">
</form>
<body>
</body>
</html>
now here is the PHP code which is a different page
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<title>Untitled Document</title>
</head>
<body>
<h3>check boxes</h3>
<?php

print <<<HERE
fries:$fries <br>
soda:$soda <br>

HERE;
$total = 0;
if (!empty($chckfries ))
{
print ("fries ,<br> \n");
$total = $total + $chkfries;
} //end if
if (!empty($chcksoda))
{
print ("soda <br> \n");
$total = $total + $chcksoda;
}

print ("Total \$$total \n")
?>

</body>
</html>
 
Back
Top