I want to loop for more than one array i was able to do for two using this code
$value=array_combine($val1,$val2); foreach($value as $vl1=> $vl2) Am now trying to do for more than two using this code but its not working I don't know where am getting it wrong.
$value=array_combine($val1,$val2,$val3,$val4,$val5,val6); foreach($value as $vl1=> $vl2,$vl3=> $vl4,$vl5=> $vl6 ) Thanks
Edited
Here's is the complete working code - Thanks to @Barmar With this code, i was able to submit multiple columns and rows into the database.
if(isset($_POST['submit'])){ $head = $_POST['head']; $surname = $_POST['surname']; $othernames = $_POST['othernames']; $affiliate_email = $_POST['affiliate_email']; $affiliation = $_POST['affiliation']; $phone_no = $_POST['phone_no']; $value=array_combine($surname,$affiliate_email,$othernames, $head,$affiliation,$phone_no); foreach ($surname as $index => $sur) { $affmail = $affiliate_email[$index]; $names = $othernames[$index]; $hd = $head[$index]; $affil = $affiliation[$index]; $phone = $phone_no[$index]; $page3="INSERT INTO tbl_name (affiliate_email,surname,othernames,affiliation,phone_no,head) VALUES '$affmail','$sur','$names','$affil','$phone','$hd')"; if(mysqli_query($db->connection, $page3)) { header("location:page4?code=$app_code"); } } }
foreach()but without knowing what the input arrays look like or the desired output, thats all i can say