what is wrong with this PHP code check boxes?

upyr1

New member
<!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>
<!--- this is supposed to take input from the user from the check boxes then display the total here is the webpage the check boxes are supposed to change a total in the PHP bellow I am using PHP 5.3.8 the book was written for PHP 5-->
<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>
<!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>
I'm not changing in the same page
 
Back
Top