我有多項選擇問答題是這樣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/>";
}
現在不是講的是回答一個或兩個是正確的用戶我想在何處運行它計算的正確和錯誤答案的人數的數量和與一個箱子沿其顯示兩個表盒計數器問題總數。
「你喜歡印度食物?」 「從不」「你的回答不正確!」 –