我有多项选择问答题是这样PHP测验显示号码接听
<p>1. Is Manhattan near New York?<br>
<input type="radio" name="ans1" value="3">
Yes<br>
<input type="radio" name="ans1" value="2">
Maybe<br>
<input type="radio" name="ans1" value="1">
No</p>
<p>2. Do you like Indian food?<br>
<input type="radio" name="ans2" value="1">
Some times<br>
<input type="radio" name="ans2" value="3">
Never<br>
<input type="radio" name="ans2" value="2">
Always</p>
页发送到自身并检查一个PHP页面,如果答案是对还是错这样
if($ans1 == "3") {
$test_complete .="Question one is <span class='green'>correct</span>, well done!<br/>";
}else{
$test_complete .="Question one is <span class='red'>incorrect</span>!<br/>";
}
// change the quest2 to the right answer
if($ans2 == "2") {
$test_complete .="Question two is <span class='green'>correct</span>, well done!<br/>";
}else{
$test_complete .="Question two is <span class='red'>incorrect</span>!<br/>";
}
现在不是讲的是回答一个或两个是正确的用户我想在何处运行它计算的正确和错误答案的人数的数量和与一个箱子沿其显示两个表盒计数器问题总数。
“你喜欢印度食物?” “从不”“你的回答不正确!” –