I am having the following issue. I have a menu form on a html webage that uses PHP to communicate with mysql database. The problem is that when a user enters dessert, it does not add a record to the mysql database and hot drinks are listed in the dessert column. Can anyone please help? Thanks
<html>
<head>
<meta content="text/html; charset=ISO-8859-1" http-equiv="content-type">
<title>Order Complete</title>
<link rel="stylesheet" type="text/css" href="default.css">
</head>
<body>
<?php
mysql_connect('localhost', 'root', 'jkkk') or die (mysql_error());
mysql_select_db('menu_res') or die (mysql_error());
$starter_price = 0.00;
$food_price = 0.00;
$drink_price = 0.00;
$dessert_price = 0.00;
$hotdrinks_price = 0.00;
$tablenumber = $_POST['tablenumber'];
$starter = $_POST['starter']; if ($starter == "None"){$starter_price == "0.00";}
$starter = $_POST['starter']; if ($starter == "Garlic Bread"){$starter_price = "2.50";}
$starter = $_POST['starter']; if ($starter == "Bruschetta"){$starter_price = "2.80";}
$starter = $_POST['starter']; if ($starter == "Focaccia"){$starter_price = "2.30";}
$starter = $_POST['starter']; if ($starter == "Fish Soup"){$starter_price = "4.10";}
$starter = $_POST['starter']; if ($starter == "Potatoe Croquettes"){$starter_price = "2.00";}
$food = $_POST['food']; if($food == "None"){$food_price = "0.00";}
$food = $_POST['food']; if($food == "Penne Bolognese"){$food_price = "8.50";}
$food = $_POST['food']; if($food == "Spaghetti Carbonara"){$food_price = "8.00";}
$food = $_POST['food']; if($food == "Lasagna"){$food_price = "8.00";}
$food = $_POST['food']; if($food == "Penne all'Arrabbiata"){$food_price = "7.50";}
$food = $_POST['food']; if($food == "Ravioli Al Salmone"){$food_price = "8.50";}
$food = $_POST['food']; if($food == "Penne Chicken"){$food_price = "8.00";}
$food = $_POST['food']; if($food == "Pizza Margherita"){$food_price = "6.50";}
$food = $_POST['food']; if($food == "Pizza Funghi"){$food_price = "7.00";}
$food = $_POST['food']; if($food == "Pizza Capricciosa"){$food_price = "8.00";}
$food = $_POST['food']; if($food == "Pizza Quattro Stagioni"){$food_price = "7.50";}
$food = $_POST['food']; if($food == "Pizza Vegetariana"){$food_price = "7.50";}
$food = $_POST['food']; if($food == "Pizza Napolitana"){$food_price = "7.00";}
$food = $_POST['food']; if($food == "Chicken Fillet"){$food_price = "11.50";}
$food = $_POST['food']; if($food == "Chicken Parma"){$food_price = "10.50";}
$food = $_POST['food']; if($food == "Duck Breast"){$food_price = "13.50";}
$food = $_POST['food']; if($food == "Spare Ribs"){$food_price = "17.00";}
$food = $_POST['food']; if($food == "Rib Eye"){$food_price = "21.50";}
$food = $_POST['food']; if($food == "Octopus In Garlic"){$food_price = "13.50";}
$food = $_POST['food']; if($food == "Pork Fillet"){$food_price = "16.50";}
$food = $_POST['food']; if($food == "Fresh Fish Of The Day"){$food_price = "21.50";}
$food = $_POST['food']; if($food == "Veggie Salad"){$food_price = "8.50";}
$food = $_POST['food']; if($food == "Caesar's Salad"){$food_price = "9.50";}
$food = $_POST['food']; if($food == "Italian Platter"){$food_price = "13.00";}
$food = $_POST['food']; if($food == "Cheese Platter"){$food_price = "9.50";}
$food = $_POST['food']; if($food == "Maltese Platter"){$food_price = "15.50";}
$drink = $_POST['drink']; if($drink == "None"){$drink_price = "0.00";}
$drink = $_POST['drink']; if($drink == "Still Water"){$drink_price = "1.00";}
$drink = $_POST['drink']; if($drink == "Sparkling Water"){$drink_price = "1.10";}
$drink = $_POST['drink']; if($drink == "Red Bull"){$drink_price = "1.30";}
$drink = $_POST['drink']; if($drink == "Pepsi"){$drink_price = "1.30";}
$drink = $_POST['drink']; if($drink == "Fanta"){$drink_price = "1.30";}
$drink = $_POST['drink']; if($drink == "7uP"){$drink_price = "1.30";}
$drink = $_POST['drink']; if($drink == "Cisk Lager"){$drink_price = "1.50";}
$drink = $_POST['drink']; if($drink == "Shandy"){$drink_price = "1.50";}
$dessert = $_POST['dessert']; if($dessert == "None"){$dessert_price = "0.00";}
$dessert = $_POST['dessert']; if($dessert == "Fruit Cake"){$dessert_price = "2.75";}
$dessert = $_POST['dessert']; if($dessert == "Chocolate Cake"){$dessert_price = "2.75";}
$dessert = $_POST['dessert']; if($dessert == "Rainbow Cake"){$dessert_price = "2.75";}
$dessert = $_POST['dessert']; if($dessert == "Apple Pie"){$dessert_price = "2.75";}
$dessert = $_POST['dessert']; if($dessert == "Tiramisu"){$dessert_price = "2.75";}
$dessert = $_POST['dessert']; if($dessert == "Selection of Ice Cream"){$dessert_price = "2.75";}
$hotdrinks = $_POST['hotdrinks']; if($hotdrinks == "None"){$hotdrinks_price = "0.00";}
$hotdrinks = $_POST['hotdrinks']; if($hotdrinks == "Pot of Tea"){$hotdrinks_price = "0.00";}
$hotdrinks = $_POST['hotdrinks']; if($hotdrinks == "Coffee"){$hotdrinks_price = "0.00";}
$hotdrinks = $_POST['hotdrinks']; if($hotdrinks == "Espresso"){$hotdrinks_price = "0.00";}
$hotdrinks = $_POST['hotdrinks']; if($hotdrinks == "Hot Chocolate"){$hotdrinks_price = "0.00";}
$hotdrinks = $_POST['hotdrinks']; if($hotdrinks == "Cappuccino"){$hotdrinks_price = "0.00";}
$total_price = $_POST['total_price'];
$total_price = $starter_price + $food_price + $drink_price + $dessert_price + $hotdrinks_price;
Print "Total Price is: $total_price Euro";
echo "<br>";
mysql_query("INSERT INTO clients(tablenumber, starter, food, drink, dessert, hotdrinks, total_price)
VALUES('$tablenumber', '$starter', '$food', '$drink', '$dessert', '$hotdrinks', '$total_price')");
Print "Your order has been complete!!! Enjoy and Thank you for choosing us!";
?>
<br> <br>
<a href="index.html">Back to selection menu </a>
</body>
</html>
Aucun commentaire:
Enregistrer un commentaire