我正在尝试创建一个包含多项选择答案的问题的页面,一旦提交了答案,我需要链接到另一个页面以通知用户他们是否已正确回答。我在这里的右边线?
这是我的问题页面:
<div id="body">
<p>Please select your answer from the list.</p>
<p><strong>1. What does PHP stand for? </strong></p>
<div="Question">
<form action='quizanswers1.php?id=1' method='post' id='1'>
<input type="radio" name="answerOne" id ="answerOne" value="A" >A) Preprocessed Hypertext Language
<br>
<br>
<input type="radio" name="answerTwo" id="answerTwo" value="B" >B) Pages Have Pictures
<br>
<br>
<input type="radio" name="answerThree" id="answerThree" value="C" >C) Hypertext Markup Language
<br>
<br>
<input type="radio" name="answerFour" id="answerFour" value="D" >D) PHP: Hypertext Preprocessor
<br>
<br>
<input type="submit" value="Submit Answer" />
</div>
</form>
</div>
</div>
这是我的结果页面:
<div id="container">
<h1>Question 1 Result</h1>
<?php
$fid = $_GET['id'];
?>
<div id="content">
<?php
$answer1= $_POST['answerFour'];
$score = 0;
if ($answer1 == "A"){$score;}
if ($answer2 == "B"){$score;}
if ($answer3 == "C"){$score;}
if ($answer4 == "D"){$score++;}
echo "<center><font face='Berlin Sans FB' size='8'>Your Score is <br> $score/1</font></center>";
?>
</div>
</div>
</div>
</div>
</body>
</html>
答案 0 :(得分:0)
您必须为每个问题添加代码。
好吧,我不知道你的建议是什么,但我认为你应该添加数据库,如果你想让它成为一个实时页面。