I set up a simple lunch menu. The user can check the items desired and the program should return prices and total.
But, it’s not - HELP!
I just started with PHP and this type of survey/order form will be of great use to me. I need to accomplish this and uderstand it. Any help will be very, very much appreciated.
.htm
[code]
Checkbox DemoCheckbox Demo
Demonstrates checkboxes
What would you like with your order?
- Fries
- Soda
- Shake
- Ketchup
.php
[code]
Checkbox DemoCheckbox Demo
Demonstrates reading checkboxes
<?php print <<<HERE chkFries: $chkFrieschkSoda: $chkSoda
chkShake: $chkShake
chkKetchup: $chkKetchup
HERE; $total = 0; if (!empty($chkFries)){ print ("You chose Fries
n"); $total = $total + $chkFries; } // end if if (!empty($chkSoda)){ print ("You chose Soda
n"); $total = $total + $chkSoda; } // end if if (!empty($chkShake)){ print ("You chose Shake
n"); $total = $total + $chkShake; } // end if if (!empty($chkKetchup)){ print ("You chose Ketchup
n"); $total = $total + $chkKetchup; } // end if print "The total cost is $$total n"; ?> [/code]