<?php
 error_reporting(E_ALL);
 ini_set('display_errors', 1);

 include('../../../config/config.php');
 date_default_timezone_set("Africa/Lagos");
 $date= date("Y/m/d");

 $CurriculumTopicIDnew = $_POST["CurriculumTopicIDnew"];
 $topicnamenew = $_POST["topicnamenew"];
 $termidnew = $_POST["termidnew"];
 $classidnew = $_POST["classidnew"];
 $campusidnew = $_POST["campusidnew"];
 $subjectidnew = $_POST["subjectidnew"];
 $userID = $_POST["userID"];
 $success = 0;

 
 $CurriculumTopicIDnewexplode = explode(',', $CurriculumTopicIDnew);
 $topicnamenewexplode = explode(',', $topicnamenew);
 $termidnewexplode = explode(',', $termidnew);
 $classidnewexplode = explode(',', $classidnew);
 $campusidnewexplode = explode(',', $campusidnew);
 $subjectidnewexplode = explode(',', $subjectidnew);

 $count = count($CurriculumTopicIDnewexplode);

 for ($i = 0; $i < $count; $i++) {
     $CurriculumTopicID = $CurriculumTopicIDnewexplode[$i];
     $topicname = $topicnamenewexplode[$i];
     $termid = $termidnewexplode[$i];
     $classid = $classidnewexplode[$i];
     $campusid = $campusidnewexplode[$i];
     $subjectid = $subjectidnewexplode[$i];

   
     $ekene_insert_progress = "INSERT INTO `progressreport`(`CurriculumTopicID`, `CampusID`, `SubjectOrCourseID`, `CourseOrSubjectTeacherUserID`, `ClassOrDepartmentID`, `TermOrSemesterName`, `TopicName`, `Date`) 
     VALUES ('$CurriculumTopicID','$campusid','$subjectid','$userID','$classid','$termid','$topicname','$date')";

       $select_import_question = mysqli_query($link, $ekene_insert_progress);
       
     if($select_import_question == true)
     {
        $success++;
     }

 }
if($success == 0)
{
    echo "3";
}
else{
    echo "4";
}
     
 ?>