Hello,
I am putting together an online ordering system for a restaurant and have all the information for each item saved in a MySQL database. When you are reviewing your selected items I need it to add together the prices of all the items you checked off on the selections page to get the order’s total price and display it.
Here is the code I have so far:
<?php
$item=$_POST['title'];
foreach ($item as $itemname)
{
$query = mysql_query("SELECT * FROM `menu` WHERE title = '$itemname'");
while($row = mysql_fetch_array($query)) {
echo "<p>" . $row['title'] . " - <span style=color:#000;>$" . $row['price'] . "</span></p>";
}
}
echo "<h3>ORDER TOTAL: </h3>";
?>
It needs to add together the $row[‘price’] values together for each item that is selected. Multiple items can be chosen.
Any help is highly appreciated!