php处理checkbox的问题 这些是javascript的问题,php是服务器本身。 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 用数组有个问题,没check的,会被跳过。 这个问题也经常遇到。需要在提交之前对checkbox进行处理,有种方法是用另外一个input type=hidden 的隐藏域来保存这个checkbox的状态。在提交之前取所有checkbox的值,如果是checked,就将隐藏域的值赋为"yes"(这个由你自己规定),否则赋为"no"。 页面中的代码:<input type="checkbox" name="isnull[]" id="isnull_'.$rownum.'" value=""><input type="hidden" name="colsnull[]" id="colsnull_'.$rownum.'" value="">javascript的处理:function saveFormSubmit(){ //....其他代码 var isnull = document.body.all("isnull[]"); var colsnull = document.body.all("colsnull[]"); for(var i=0;i<isnull.length;i++){ if (isnull[i].checked){ colsnull[i].value = "yes"; }else { colsnull[i].value = "no"; } } //....其他代码 document.saveForm.submit();//saveForm为表单名} <script> function checkAll(thisForm){ var chkbox=thisForm.getElementsByName['test[]']; for(var i=0;i<chkbox.length;i++){ if(chkbox[i].checked){ break; return false; } } } </script> 我的表述可能不食很清楚register_globals off的情况下接收 表单<form action="test" method="post"><input type="checkbox" name="test[]" value="1"><input type="checkbox" name="test[]" value="2"><input type="checkbox" name="test[]" value="3"><input type="checkbox" name="test[]" value="4"><input type="checkbox" name="test[]" value="5"></form>的值请各位大虾指教? 得到的是一个数组,可以用print_r($_POST['test']);来看一下 是名为test[]的数组,你不要用"test[]"这个名字!用"test"就好了 怎样实现对几个数据库并行查询 点击按钮跳到另一个界面 急问DEDECMS,个人不太熟悉PHP?急等CMS老鸟帮我指点下。 关于php的webservice问题 <****>一个PHP处理查询更新的小问题,,请大家指教:) include_once的使用 foreach如何移动到下一个数组。 phpmyadmin中添加字段时可以设定位于哪个字段之前或之后,原理是什么,这怎么实现啊 请帮忙写一个查看文件和上传文件的php php模拟用户登陆问题,请高手帮我看看 怎么把mysql的一个表中的记录数赋值给一个变量?? $a==5与5==$a有什么不同?
没check的,会被跳过。
<input type="checkbox" name="isnull[]" id="isnull_'.$rownum.'" value="">
<input type="hidden" name="colsnull[]" id="colsnull_'.$rownum.'" value="">
javascript的处理:
function saveFormSubmit(){
//....其他代码
var isnull = document.body.all("isnull[]");
var colsnull = document.body.all("colsnull[]");
for(var i=0;i<isnull.length;i++){
if (isnull[i].checked){
colsnull[i].value = "yes";
}else {
colsnull[i].value = "no";
}
}
//....其他代码
document.saveForm.submit();//saveForm为表单名
}
function checkAll(thisForm){
var chkbox=thisForm.getElementsByName['test[]'];
for(var i=0;i<chkbox.length;i++){
if(chkbox[i].checked){
break;
return false;
}
}
}
</script>
<form action="test" method="post">
<input type="checkbox" name="test[]" value="1">
<input type="checkbox" name="test[]" value="2">
<input type="checkbox" name="test[]" value="3">
<input type="checkbox" name="test[]" value="4">
<input type="checkbox" name="test[]" value="5">
</form>
的值
请各位大虾指教?