Hello:
I am having a problem with getting the actual values from the od_qty[] array in the code below to pass to the processing script.
while ($row = mysql_fetch_array ($result, MYSQL_ASSOC)) {
echo '<tr><td align="left">' . $row['category'] . '</td>
<td align="left"><input type="checkbox" name="selection[]" value="' .$row['dn'] .'"></td>
<td align="left" width="35"><input type="text" name="od_qty[]" id="od_' .$row['d1'] .'_' . $row['price'] . '" size="2" onchange="CalculateTotal(this.form)"></td>
<td align="left">' . $row['dn'] . '</td>
<td align="left">' .$row['dd'] . '</td>
<td align ="right">' . $row['price'] . '</td></tr>';
}
I have the following in the process_form.php script to confirm the values sent.
<p id="content">You ordered:</p>
<p id="content">';
foreach ($_POST['selection'] as $key => $val) {
echo $qty. ' ' .$val.'<br />';
}
echo '</p><p>';
// This is here for testing purposes to see what is being passed.
foreach($_POST as $key => $value) {
echo $key . ' has a value of: ' . $value . "<br>\n";
}
echo '</p>';
} else { // Invalid submitted values.
echo '<h1 id="mainhead">Error!</h1>
The foreach is only counting the selection array and sending the dish_name.
My questions are how do I get the actual quantity of the items, the dish_name, and the dish_price of the items ordered to:
1) Post to the database along with the dish_name (fields: od_qty, dish_name, dish_price); I do have an INSERT INTO statement as follows:
$query = "INSERT INTO order_details (od_id, dish_id, od_qty, dish_price, order_date) VALUES ('', '$d1', '$qty', 'price', NOW())";
2) Give the form upon submission an order_id (I tried sessions but for some reason could not get it to work);
3) Display the information in the browser to confirm prior to the user entering their information??
Any assistance would be greatly appreciated, or being pointed to a source to help me.
Thank you in advance.