Re: [問題] checkbox的問題
這是小弟我的程式碼
<form method=post action= account.php>
<?php
include("connectdb.php");
$sql= "select * from t1";
$row= mysql_query($sql);
while(list($no , $a1 , $a2 , $a3 , $choice1 , $choice2 , $choice3 , $choice4 , $choice5 , $choice6 )=mysql_fetch_row($row))
{
echo "第
$no
題 $a1<p>";
echo "題目:
$a2
<p>";
if($a3==1)
{
if($choice1==NULL)break;
echo "
<input type=radio name= ans1[] value=1> $choice1
";
if($choice2==NULL) break;
echo "
<input type=radio name= ans1[] value=2> $choice2
";
if($choice3==NULL) break;
echo "
<input type=radio name= ans1[] value=3> $choice3
";
if($choice4==NULL) break;
echo "
<input type=radio name= ans1[] value=4> $choice4
";
if($choice5==NULL) break;
echo "
<input type=radio name= ans1[] value=5>$choice5
";
if($choice6==NULL) break;
echo "
<input type=radio name= ans1[] value=6>$choice6<p>
";
}
else if($a3==2)
{
echo "
<select name=ans1[]>
<option value=1> $choice1
<option value=2> $choice2
<option value=3> $choice3
<option value=4> $choice4
<option value=5> $choice5
<option value=6> $choice6
</select>
<p>
";
}
else if($a3==3)
{
if($choice1==NULL)break;
echo "
<input type=checkbox name= ans1[] value=1> $choice1
";
if($choice2==NULL)break;
echo "
<input type=checkbox name= ans1[] value=2>$choice2
";
if($choice3==NULL)break;
echo "
<input type=checkbox name= ans1[] value=3>$choice3
";
if($choice4==NULL)break;
echo "
<input type=checkbox name= ans1[] value=4> $choice4
";
if($choice5==NULL)break;
echo "
<input type=checkbox name= ans1[] value=5> $choice5
";
if($choice6==NULL)break;
echo "
<input type=checkbox name= ans1[] value=6> $choice6
<p>";
}
}
?>
<p><input type=submit value=送出結果><input type= reset value= 清除>
</form>
--
※ 發信站: 批踢踢實業坊(ptt.cc)
◆ From: 220.133.214.141
推
03/18 21:47, , 1F
03/18 21:47, 1F
討論串 (同標題文章)
完整討論串 (本文為第 3 之 5 篇):
問題
1
1