} else { $ptid = ''; } if (isset($_POST['Trainee_Feedback_ID'])) { $tp->setValue('traineefeedbackid', $_POST['Trainee_Feedback_ID']); } if (isset($_POST['evaluationanswerid'])) { $evaluationanswerid = $_POST['evaluationanswerid']; } if (isset($_POST['ans'])) { $answer = $_POST['ans']; } if (isset($_POST['questionid'])) { $questionid = $_POST['questionid']; } $tp->saveEvaluation(); if (isset($answer)) { $i = 0; $j = count($questionid); while ($i < $j) { $tp->setValue('questionid', $questionid[$i]); $tp->setValue('answer', $answer[$i]); if (isset($evaluationanswerid[$i])) { $tp->setValue('evaluationanswerid', $evaluationanswerid[$i]); } else { $tp->setValue('evaluationanswerid', ''); } $tp->saveAnswer(); $i++; } }