Re: [問題] checkbox的問題

看板Web_Design作者 (￾N￾ )時間17年前 (2007/03/18 17:16), 編輯推噓1(100)
留言1則, 1人參與, 最新討論串3/5 (看更多)
這是小弟我的程式碼 <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
文章代碼(AID): #15_GDStg (Web_Design)
文章代碼(AID): #15_GDStg (Web_Design)