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'; // Get Answers for Questions; $q = new Questions(); $ans_sys = $q->getAnswersList($questions); echo $ans_sys; echo $ans_user; $userobj = json_decode($ans_user);