Hello,
I have the following code displaying a checkbox with some other options as seen on tandoorpgh.com/placeanorder under the section Main Courses (non-vegetarian).
The problem I'm having is when the form process script runs, as seen below, the script only picks up the checkbox values which is the entrees' name but I need it to attach the quantity and spice level to each item selected as well. Can anyone help? It's appreciated!Code://Main Courses (non-vegetarian) echo '<h3>Main Courses (non-vegetarian)</h3>'; $query = mysql_query("SELECT * FROM `menu` WHERE category = 'entree'"); while($row = mysql_fetch_array($query)) { echo '<input type="checkbox" name="title[]" value="' . $row['title'] . '" /><b><span id=text_black>' . $row['title'] . '</span> - Quantity: <input type=text name=quantity maxlength=1 size=1> - Spice Level: <select name=spice_level> <option value=Mild>Mild</option> <option value=Medium>Medium</option> <option value=Hot>Hot</option> <option value=Extra Hot>Extra Hot</option> </select></b> <span id="text_black">- $' . $row['price'] . '<br><i>' . $row['description'] . '</i></span> <br><br>'; }
Code:$item=$_POST['title']; $_SESSION['items'] = $item; foreach ($item as $itemname) { $query = mysql_query("SELECT * FROM `menu` WHERE title = '$itemname'"); while($row = mysql_fetch_array($query)) { $total = $total + $row['price']; $_SESSION['quantity'] = $_POST['quantity']; echo "<p>" . $_SESSION['quantity'] . " " . $row['title'] . " - <span style=color:#000;>$" . $row['price'] . "</span></p>"; $_SESSION['total'] = $total; } }







Bookmarks