Can anyone see what is wrong with the following code?
I'm trying to carry out a foreach loop on 2 arrays from a form.
Form Code:
<td>
<input type="checkbox" name="PR[]" value="DP01">Version 1 Daypack - $55.00<br/>
<input type="checkbox" name="PR[]" value="DP02">Version 2 Daypack - $30.00<br/>
</td>
<td>
<input type="text" name="QTY[]" size = "2"/><br/>
<input type="text" name="QTY[]" size="2"/><br/>
</td>
PHP Code:
if(!empty($_POST['PR']))
{
foreach (array_combine($_POST['PR'], $_POST['QTY']) as $PRS => $QTYS)
{
$sql="INSERT INTO ORDER_TBL (TRANSACTION_ID, CUSTOMER_ID, PRODUCT_ID, QUANTITY)
VALUES ('','$_SESSION[user]','$PRS,'$QTYS)";
if (!mysqli_query($con,$sql))
{
die('Error: ' . mysqli_error($con));
exit;
}
}
}