for ($i=0; $i<$total_questions_for_exam; $i++) {
$question_id= $question_and_answers[$i]['question_id'];
$numberofanswersperquestion = count_answers_belongToOne_questionNew($question_id);
//die(var_dump($question_id));
$student_answer_per_question = retrieve_student_result ($_SESSION['user_id'], $_GET['quiz_id'], $question_id);
echo ' <table class="table table-bordered table-condensed table-datatable table-hover">
<tbody>
<tr>
<td style="text-align: left;" width="100%"><strong>Question '. ($i+1) .'</strong></td>
</tr>
<tr>
<td style="text-align: left;" width="100%">' . $question_and_answers[$i]['question_name'] .'</td>
</tr>
<tr>
<td style="text-align: left;" width="100%" class="warning"><em>Question Not attempted</em><br><strong>Correct Answer is</strong><br>' . $numberofanswersperquestion[0]['answer_name'] . '</td>
</tr>
<tr>
<td style="height: 5px;" width="100%"> </td>
</tr>
<tr>
<td style="height: 5px;" width="100%"> </td>
</tr>
</tbody>
</table>';
}
Hi guys I have this for loop, what I am trying to do is, only print this
<tr>
<td style="text-align: left;" width="100%" class="warning"><em>Question Not attempted</em><br><strong>Correct Answer is</strong><br>' . $numberofanswersperquestion[0]['answer_name'] . '</td>
</tr>
based on an if statement. But how can put that if statement inside that echo ??
I have tried this way, by
' . if() {} . '
but I couldn't get it to work this way.
this is what I want inside the if statement
if($student_answer_per_question === '' || '') {
<tr>
<td style="text-align: left;" width="100%" class="warning"><em>Question Not attempted</em><br><strong>Correct Answer is</strong><br>' . $numberofanswersperquestion[0]['answer_name'] . '</td>
</tr>
}
I hope I have explained the problem in detail and I appreciate any help from you guys. Thanks