我正在运行这段代码。
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>";
}
当我导航到页面时,最后一行的数据已经显示。
如何获取信息,以便用户单击“提交”时显示“正确答案:”,而不是在导航到网页后立即显示?
我知道我的单选按钮目前基本上没有用。那是另外一次,我至少想尝试找出那个。
这是显示内容的示例。