【发布时间】:2017-07-23 15:45:28
【问题描述】:
将有 4 个选项 选项1,选项2,选项3,选项4
(A) Any student who does not have the power to learn in a group is almost always unsuccessful
(B) EDPeer group pressure and mutual understanding of any concept develops better understanding among students
(C) ESAny student who does not have the power to learn in a group is almost always unsuccessful
(D) Peer group pressure and mutual understanding of any concept develops better understanding among students
$single_answer1="ESA 任何没有能力学习的学生 一个小组几乎总是不成功的”。
$single_answer1 是学生选择的答案。
从上述选项中,“option1”是正确答案,但学生选择“option3”。
我必须区分像 for
背景为绿色的“option1”
“option3”,背景颜色为红色
如果有时 option1 和 answer 两者相等,则将边框颜色设为绿色。
如果 single_answer 为“未定义”或空值,则它将显示黄色背景的正确答案(未选择任何内容和正确答案)。
<?php if ($option1 == $single_answer1) { ?>
<label style="font-size:14px;background-color:lightgray;border:1px solid green;padding:10px" >
<label class="review-icon"><i class="fa fa-fw fa-check-circle-o" style="color:green;font-size:15px"></i></label>
<span class="">(A) <?php echo $option1; ?>
</label>
<?php } else if ($single_answer1 != $option1) {
?>
<label style="font-size:14px;background-color:lightgray;border:1px solid red;padding:10px" >
<label class="review-icon"><i class="fa fa-fw fa-times" style="color:red;font-size:15px"></i></label>
<span class="">(A) <?php echo $option1; ?>
</label>
<?php } else if ($single_answer1 == 'undefined') { ?>
<label style="font-size:14px;background-color:yellow;border:1px solid green;padding:10px" >
<label class="review-icon"><i class="fa fa-fw fa-check-circle-o" style="color:green;font-size:15px"></i></label>
<span class="">(A) <?php echo $option1; ?>
</label>
<?php } else { ?>
<label style="font-size:14px">
<span class=""><input type="radio" name="single_question_answer1" value="<?php echo $option1; ?>" ></span> (A) <?php echo $option1; ?>
</label>
<?php } ?><br/><br/>
我试过这样,但我得到错误的输出请任何人帮助我摆脱这个问题。在此先感谢。
【问题讨论】:
标签: php css radio-button