2个回答
展开全部
<?php
$flag=0;
if(isset($_POST['answer'])&&$_POST['answer'] != "")
{
$flag = 1;
}
?>
<script type="text/javascript">
function showMore()
{
document.getElementById("correct_answer").style.display="block";
}
</script>
<body>
<form name="form" action="index.php" method="post">
<tr align="center">
<td>
1.一道选择题,选择答案()
</td>
</tr>
<tr align="center">
<td>
<input type="radio" name="answer" value="选项1">选项1
</td>
</tr>
<tr align="center">
<td>
<input type="radio" name="answer" value="选项2">选项2
</td>
</tr>
<tr align="center">
<td>
<input type="radio" name="answer" value="选项3">选项3
</td>
</tr>
<tr align="center">
<td>
<input type="radio" name="answer" value="选项4">选项4
</td>
</tr>
<tr align="center">
<td>
<input type="submit" name="tijiao" value="提交" onclick="showMore()">
</td>
</tr>
<?php if ($flag == 1) { ?>
<div id="correct_answer" style="display:block">
<?php } else {?>
<div id="correct_answer" style="display:none">
<?php }?>
<tr><td>
正确答案:选项1 得分:0 </td></tr>
</div>
</form>
</body>
$flag=0;
if(isset($_POST['answer'])&&$_POST['answer'] != "")
{
$flag = 1;
}
?>
<script type="text/javascript">
function showMore()
{
document.getElementById("correct_answer").style.display="block";
}
</script>
<body>
<form name="form" action="index.php" method="post">
<tr align="center">
<td>
1.一道选择题,选择答案()
</td>
</tr>
<tr align="center">
<td>
<input type="radio" name="answer" value="选项1">选项1
</td>
</tr>
<tr align="center">
<td>
<input type="radio" name="answer" value="选项2">选项2
</td>
</tr>
<tr align="center">
<td>
<input type="radio" name="answer" value="选项3">选项3
</td>
</tr>
<tr align="center">
<td>
<input type="radio" name="answer" value="选项4">选项4
</td>
</tr>
<tr align="center">
<td>
<input type="submit" name="tijiao" value="提交" onclick="showMore()">
</td>
</tr>
<?php if ($flag == 1) { ?>
<div id="correct_answer" style="display:block">
<?php } else {?>
<div id="correct_answer" style="display:none">
<?php }?>
<tr><td>
正确答案:选项1 得分:0 </td></tr>
</div>
</form>
</body>
展开全部
<?php
//wt:问题,fen:分数,da:可选答案,ok正确选项
$list=array(
'wt'=>'1+9=?',
'fen'=>8,
'da'=>array(0=>'A.1',1=>'B.10',2=>'19'),
'ok'=>1
);
if(isset($_POST)){
$da=$_POST['da'];
$da=intval($da);
if($da==$list['ok']){
echo '回答正确,得分:' . $list['fen'];
}else{
echo '回答错误;
}
}
?>
<form action="" method="post">
题目:<?php echo ($list['wt']);?> <br />
<?php foreach($list['da'] as $key=>$da){ ?>
<input type="radio" name="da" value="<?php echo $key;?>" /><?php echo $da;?>
<?php } ?>
<input type="submit" value="提交" />
</form>
//wt:问题,fen:分数,da:可选答案,ok正确选项
$list=array(
'wt'=>'1+9=?',
'fen'=>8,
'da'=>array(0=>'A.1',1=>'B.10',2=>'19'),
'ok'=>1
);
if(isset($_POST)){
$da=$_POST['da'];
$da=intval($da);
if($da==$list['ok']){
echo '回答正确,得分:' . $list['fen'];
}else{
echo '回答错误;
}
}
?>
<form action="" method="post">
题目:<?php echo ($list['wt']);?> <br />
<?php foreach($list['da'] as $key=>$da){ ?>
<input type="radio" name="da" value="<?php echo $key;?>" /><?php echo $da;?>
<?php } ?>
<input type="submit" value="提交" />
</form>
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询