I got this 2 array in a form to be process. However, i only manage to get the output from only one of the array. Sample as below :
<inputs id="location" type="text" name="data[]" value=""/>
<input id="shipval" type="text" name="data[][id]" value=""/>
And in the PHP part is below :
foreach ($_POST ["data"] as $id => $subs) {
foreach ($subs as $key=>$sub) {
$subcategory = $sub;
if($subs['id']=="$subcategory"){
echo $sql = " insert into x(kodLebuhraya,kodSeksyen) values ('".$subs['id']."','".$sub."')";echo "<br>";
}else{
//echo "hi2";
echo $sql = " insert into x(kodLebuhraya,kodSeksyen) values ('".$subs['id']."','".$sub."')";echo "<br>";
}
}
}
It means one location for one shipval. i have multiple input field for location and shipval. Can you guys enlight me which one is wrong. Thanks in advanced.