I need some help with nested foreach.
This is my code:
$program = $_POST['program'];
$licence = $_POST['licence'];
foreach($program as $p){
foreach($licence as $l){
mysql_query("INSERT INTO programs (pcname, program, licence) VALUES ('". $pcname ."', '". $p ."', '". $l ."')");
}
}
This doesn't work and I know why. But I cannot find a way to fix the issue. The issue is, that it is going through all the values in the inside foreach, then is is going through them all, all over again for the next value in the outside foreach.
This probably wasn't explained very well, but hopefully you can understand what I am doing in trying to achieve, and to help me out.