本文介绍了需要有关复选框选择的帮助的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述 Hello Everyone .. 我使用下面给出的php为复选框开发代码; <?php < br mode = hold /? > $解析度= DBselect( menu_master, *, , , ); $ nubofrows = DB_num_rows($ res); if($ nubofrows> 0){ while($ rows = DB_fetch_array($ res)){ $ menuid =(int)$ rows [mid]; $ menuname = $ rows [mname]; if(isset($ _ GET [aid])){ $ aid =(int)$ _ GET [aid]; $ res1 = DBselect(adrole_master,*,adid = $ aid,,); $ numofrow = DB_num_rows($ res1); if($ numofrow> 0){ $ i = 0; for($ i = 0; $ i < = $ numofrow-1; $ i ++){ $ row = DB_fetch_array( $ RES1); $ menuid1 = $ row [ mid]; if($ menuid = = $ menuid1){ $ chkstatus = checked = checked ; $ i = $ I + 1; } else { $ chkstatus = ;} } } } //} ? > < 输入 type = 复选框 id = chkaccess 名称 = chkaccess [] <?php echo $ chkstatus; ?? > style =float:left; value =<? php echo $ menuid ;??> /> <? php echo $ menuname ;??> < ? php}} // }? ?> 当我要查看选中了哪个复选框时,它仅显示2个复选框,根据我的数据库选择字段有3条记录可供选择3复选框。 请帮我解决这个问题? 提前致谢.. 解决方案 res = DBselect(menu_master,*,,,); nubofrows = DB_num_rows( RES); if( Hello Everyone..I developed code for check box by using php it given below;<?php <br mode="hold" /?>$res=DBselect("menu_master","*","","","");$nubofrows=DB_num_rows($res);if($nubofrows>0){while($rows=DB_fetch_array($res)){ $menuid=(int)$rows["mid"];$menuname=$rows["mname"];if(isset($_GET["aid"])){$aid=(int)$_GET["aid"];$res1=DBselect("adrole_master","*","adid=$aid","","");$numofrow=DB_num_rows($res1);if($numofrow>0){$i=0;for($i=0;$i <=$numofrow-1;$i++){$row=DB_fetch_array($res1);$menuid1=$row["mid"];if($menuid==$menuid1){$chkstatus="checked=checked"; $i=$i+1; } else { $chkstatus="";} } } }//}?> <input type="checkbox" id="chkaccess" name="chkaccess[]" <?php echo $chkstatus; ??> style="float:left;" value="<?php echo $menuid;??>" /> <?php echo $menuname;??> <?php }}//}??> When i am going to see which check box selected it show me only 2 check box selected where as as per my database field there are 3 records for it to select 3 check box.Please help me to solve that problem?Thanks in advance.. 解决方案 res=DBselect("menu_master","*","","","");nubofrows=DB_num_rows(res);if( 这篇关于需要有关复选框选择的帮助的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!
10-28 16:28