I want to store all the studentId in one group
i have tried like this:
i am bit new with for/foreach loops.
if($_POST['action']=='startGdstudents') {
parse_str($_POST['participantsForGd'], $participantsForGd);
$jobID = $participantsForGd['jobID']; // example: 85
$group = mysqli_real_escape_string($conn,$_POST['group']); // example: 2
foreach ($participantsForGd as $k => $v){
foreach ($v['StudentId'] as $studentid => $student){
$q = $conn->query("INSERT INTO r_job_groups (student_id,job_id,group_id) VALUES (".$student.",".$jobID.",".$group.") ");
}
}
My errors:
Warning: Illegal string offset 'StudentId' in /home2/amerytec/public_html/lc-latest/gdcontroller .php on line 171
Warning: Invalid argument supplied for foreach() in /home2/amerytec/public_html/lc-latest /gdcontroller.php on line 171
Warning: Invalid argument supplied for foreach() in /home2/amerytec/public_html/lc-latest /gdcontroller.php on line 171