I have a form with POST method with two select dropdown. In both select multiple selections can be made. Now I am using foreach loop insert data in MySQL. But it only works with single select dropdown not with 2nd select dropdown. I used foreach(){ foreach(); }
loop with again it doesn't work. How to insert data with multiple select dropdown which has multiple='multiple' enabled.
This is my select dropdown in same FORM
$cid = $row['cid'];
$work_location = $_POST['work_location'];
$interest = $_POST['interest'];
foreach ($work_location as $work) {
foreach ($interest as $int) {
$insert_oth_data = "INSERT INTO resume_spec_data(work_location,interest)
VALUES($work, $int)";
mysqli_query($con, $insert_oth_data);
}
}
Also, I don't want to use implode function as it will make data extraction difficult as table grows. I want to store all select options in separate row of MySQL database.