I'm running this code.
while ($row = mysqli_fetch_array($result)) {
$qID = $row['question_id'];
$a = $row['answerA'];
$b = $row['answerB'];
$c = $row['answerC'];
$d = $row['answerD'];
$rA = $row['rightAnswer'];
echo "QID: " . $row["question_id"]. "<br>".
"Question Type: " . $row["questionType"]. "<br><br>" .
"Question: " . $row["question"]. "<br><br><br>";
echo "<input type = 'Radio' Name = 'Answer[$qID]' value ='A' > A. $a <br>";
echo "<input type = 'Radio' Name = 'Answer[$qID]' value ='B' > B. $b <br>";
echo "<input type = 'Radio' Name = 'Answer[$qID]' value ='C' > C. $c <br>";
echo "<input type = 'Radio' Name = 'Answer[$qID]' value ='D' > D. $d <br><br>";
echo "<input name='submit' type='submit' value='Submit'><br><br>";
if(isset($_POST['Submit'])) {
echo "Right Answer: " .$row["rightAnswer"]. "<br><hr>";
}
When I navigate to the page, the data from the last line is already displayed.
How do I get it so that when the user clicks submit, it displays "Right Answer: " instead of displaying it as soon as they navigate to the webpage?
I know my radio buttons are essentially useless at this point. That's for another time, I at least want to try and figure that one out.
Here's an example of what is displayed.