$itm_detail=$_POST[‘itm_detail’];
$t9=explode(",",$itm_detail);
//Loop through the array
for($i = 0, $c = count($t9); $i < $c; $i += 3) {
echo $t9[$i]. ‘
’.$t9[$i+1]. ‘
’.$t9[$i+2]. ‘
’;
// Insert a row of information into the table “order_item”
$sql_3="INSERT INTO order_item (Order_No, Itm_Code, Itm_Desc, Itm_Qty)
VALUES (’$_POST[t1]’, ‘{$t9[$i]}’, ‘{$t9[$i + 1]}’, ‘{$t9[$i + 2]}’)";
// Add a comma if this is not the last batch
if($i + 3 < $c) {
$sql_3 .= ", ";
}
}
mysql_query($sql_3,$con);