i am trying to store data from with same name fields of three different types
like
<td><input name="itemname[]" value="ball" ></td>
<td><input name="itemname[]" value="racket" ></td>
<td><input name="itemname[]" value="shoes" ></td>
<td><input name="subitem[]" value="big"></td>
<td><input name="subitem[]" value="grenn"></td>
<td><input name="subitem[]" value="sports"></td>
<td><input name="quantity[]" value="10"></td>
<td><input name="quantity[]" value="10"></td>
<td><input name="quantity[]" value="10"></td>
and now i trying to insert them into the table 'selected_items' and i want somethinglike
itemname | subitem | quantity
ball------- big------10
racket----- green ----10
shoes------ sports ----10
please help me
edited
i tried doing with foreach
foreach($_POST['quantity'] as $val) {
$sql2 = "INSERT INTO items_selected (jobsheet_id,item_name,subitem,quantity) VALUES ('$jobid','aaa', 'bbb', '{$val}')";
if (!mysqli_query($this->con,$sql2))
{
die('Error: ' . mysqli_error($this->con));
}
}
the problem in the above code, i can only insert one column values. how can i insert the values for other column from post array
thank you