I am new to php. I am working on quiz. My codes are working fine. The problem all the question appears in one page but I don't want it to be like that. I need the question show one. once answer go to next question. I have tried many ways but i t doesn't work. Help Please. here is my code.
<?php
$selQuest = $conn->query("SELECT * FROM exam_question_tbl WHERE exam_id='$examId' ORDER BY rand() LIMIT $exDisplayLimit");
if($selQuest->rowCount() > 0)
{
$i = 1;
while ($selQuestRow = $selQuest->fetch(PDO::FETCH_ASSOC)) { ?>
<?php $questId = $selQuestRow['eqt_id']; ?>
<tr>
<td>
<p><b><?php echo $i++ ; ?> .) <?php echo $selQuestRow['exam_question']; ?></b></p>
<div class="col-md-4 float-left">
<div class="form-group pl-4 ">
<input name="answer[<?php echo $questId; ?>][correct]" value="<?php echo $selQuestRow['exam_ch1']; ?>" class="form-check-input" type="radio" value="" id="invalidCheck" required >
<label class="form-check-label" for="invalidCheck">
<?php echo $selQuestRow['exam_ch1']; ?>
</label>
</div>
<div class="form-group pl-4">
<input name="answer[<?php echo $questId; ?>][correct]" value="<?php echo $selQuestRow['exam_ch2']; ?>" class="form-check-input" type="radio" value="" id="invalidCheck" required >
<label class="form-check-label" for="invalidCheck">
<?php echo $selQuestRow['exam_ch2']; ?>
</label>
</div>
</div>
<div class="col-md-8 float-left">
<div class="form-group pl-4">
<input name="answer[<?php echo $questId; ?>][correct]" value="<?php echo $selQuestRow['exam_ch3']; ?>" class="form-check-input" type="radio" value="" id="invalidCheck" required >
<label class="form-check-label" for="invalidCheck">
<?php echo $selQuestRow['exam_ch3']; ?>
</label>
</div>
<div class="form-group pl-4">
<input name="answer[<?php echo $questId; ?>][correct]" value="<?php echo $selQuestRow['exam_ch4']; ?>" class="form-check-input" type="radio" value="" id="invalidCheck" required >
<label class="form-check-label" for="invalidCheck">
<?php echo $selQuestRow['exam_ch4']; ?>
</label>
</div>
</div>
</div>
</td>
</tr>
<?php }
?>
<tr>
<td style="padding: 20px;">
<button type="button" class="btn btn-xlg btn-warning p-3 pl-4 pr-4" id="resetExamFrm">Reset</button>
<input name="submit" type="submit" value="Submit" class="btn btn-xlg btn-primary p-3 pl-4 pr-4 float-right" id="submitAnswerFrmBtn">
</td>
</tr>
<?php
}
else
{ ?>
<b>No question at this moment</b>
<?php }
?>