$test = $testList[$ind]; // Get TestID from TestDetails Table $q = new Questions(); $json = $q->getIdTestDetails($courseList, $test); echo "ID List :: " . $json; $jsonIterator = new RecursiveIteratorIterator(new RecursiveArrayIterator(json_decode($json, TRUE)), RecursiveIteratorIterator::SELF_FIRST); foreach ($jsonIterator as $key => $val) { if (!is_array($val)) { if ($key == 'idTestDetails') { $id = $val; } } } echo $id . " " . $addQuestion . " " . $t_option1 . " " . $t_option2 . " " . $t_option3 . " " . $t_option4 . " " . $answer . " " . $active; // Add Question in testquestion Table $q->addQuestions($id, $addQuestion, $t_option1, $t_option2, $t_option3, $t_option4, $answer, $active); } } if ($action == 'FinalTest') { $qtotal = $_GET["qtotal"]; $q = new Questions(); $json = $q->getFinalExamQuestions('1', $qtotal); echo $json; } if ($action == 'SendFinalAnswers') { $userId = $_SESSION[constant("SESSION_USER_REGID")]; $testType = $_GET["testType"]; $ans_user = $_GET["answers"]; $questions = $_GET["questions"]; $testId = 0; $testName = 'All';