PHP Online Ordering System Looping Problem!?

  • Thread starter Thread starter luvdalife32
  • Start date Start date
L

luvdalife32

Guest
Hello,

I am designing an online ordering system for a restaurant. I have a menu with check boxes by each item where the customer can select which items they desire. The menu is located at tandoorpgh.com/placeanorder

The problem is that when the order is processed I need it to store each checked off item as a session variable. In the following code, it only selects the first item checked and not the rest if there is more than one. Any help is appreciated!

$item=$_POST['title'];
foreach ($item as $itemname)
{

$query = mysql_query("SELECT * FROM `menu` WHERE title = '$itemname'");
while($row = mysql_fetch_array($query)) {

$total = $total + $row['price'];

echo "<p>" . $row['title'] . " - <span style=color:#000;>$" . $row['price'] . "</span></p>";

$allitems = $row['title'] . $row['price'];

$_SESSION['items'] = $allitems;
$_SESSION['total'] = $total;
}
}
 
Back
Top