如何显示YES和NO值,而不仅仅是YES [英] How do I show values YES and NO not just YES

查看:167
本文介绍了如何显示YES和NO值,而不仅仅是YES的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

From page1.php I can show answer/s I selected from <select name='question[]'> even if the answers are correct or not.
Then on page 2 put the values chosen in a foreach 
If I chose the correct answers, the results are shown in my table
i.e. 	Q1. What is an apple, Ans. Fruit
	Q2. What is a PC, Ans. Personal Computer
Both will show in my table showing YES, however if do this
 	Q1. What is an apple, A. Tree
	Q2. What is a PC, A. Personal Computer
In my table the result only shows Q2 YES
But, I would like to show BOTH YES and NO answers.
Any help and or suggestion most appreciated

My code, from values in my database table:
while ($row = mysqli_fetch_array($query, MYSQLI_ASSOC)) {
	$quizid = $row["quizid"];
	$qno = $row["questionno"];
	$question = $row["question"];
	$qanswer = $row["answer"];
	$qanswer1 = $row["answer1"];
	$qanswer2 = $row["answer2"];
	$qanswer3 = $row["answer3"];
	$qanswer4 = $row["answer4"];
	$qanswer5 = $row["answer5"];
$noofquest = $noofquest + 1;
foreach($_POST['question'] as $myAns) {
	if ($myAns == $qanswer) {
		$qright = $qcorrect;
	$score = $score + 1;
	} else {
	$qright = $qwrong;
	continue;
}
My table:
		echo "<tr class='myTR_2'>
		<td id='myTD_2' width='50'>$qno</td>
		<td id='myTD_2' width='450'>$question</td>
		<td id='myTD_2' width='200'>$myAns</td>
		<td id='myTD_2' width='100'>$qright</td>
		</tr>";





我尝试了什么:



尽管我已经找到了搜索网络,现在大约3周



What I have tried:

As much a I have found searching the net, about 3 weeks now

推荐答案

row = mysqli_fetch_array(
row = mysqli_fetch_array(


query,MYSQLI_ASSOC)){
query, MYSQLI_ASSOC)) {


quizid =


这篇关于如何显示YES和NO值,而不仅仅是YES的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆