I have a page that lists all the products bought in a particular consingment. The user can then choose which products to re-order (by clicking on a checkbox) and input a quantity (text input). These are then passed onto another page (listbyconsg.php) that will add the details into a new table, but I can't seem to get this working and would appreciate direction or help. Can anyone help? Thanks.
$con=$_REQUEST['consignment'];
$sql = "SELECT * FROM products,supplier
WHERE products.consignment= $con
AND products.supplier = supplier.supplierID
ORDER BY products.supplier";
$result = mysql_query($sql, $link);
?>
<form action='listbyconsg.php' method='post'>
<?
echo "<table cellpadding='0' cellspacing='0' border='1'>";
echo "<tr> <th>Description</th> <th>Product Size</th> <th>Barcode</th> <th>Product Code</th>
<th>Image</th> <th> # </th> <th> Quantity </th></tr>";
while($row = mysql_fetch_array( $result )) {
echo "<tr><td>";
echo $row['description'];
echo "</td><td>";
echo $row['productSize'];
echo "</td><td>";
echo $row['barcode'];
echo "</td><td>";
echo $row['productCode'];
echo "</td><td align='center'>";
echo '<img src="http://bargainsupplies4u.co.uk/productpics/' . $row['barcode'] . '.jpeg">';
echo "</td>"; ?>
<td><input name="checkbox[]" type="checkbox" id="checkbox[]" value="<?= $row['id'] ?>" ></td>
<td>Qty: <input name="quantity[]" type="text" ></td></tr>
<?
}
echo "</table>";
?>
<input type='submit' value='Submit' />
</form>
Then on the other page (listbyconsg.php), I have the following so far....
$get_id=$_POST['checkbox'];
$get_qty=$_POST['quantity'];
I am unsure then as to how to loop through both these arrays and add information into another table with the something thing like this:
$sql1 = "INSERT INTO newOrder (id, orderQuantity)
VALUES ('$get_id', '$get_qty')"