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"就好了 FTP问题,求大侠帮帮忙。。 php 中文件上传问题 如何把对应信息下的所有图片全部删除?我的代码只删除一张图片。。。 老问题还是没搞懂,请教 PHP怎么格式化输出两位小数的数值? 有没有哪位有个 比较好的在线涂鸦板?flash的。谢谢。 如何用正则表达式或php的函数取出一个页面中的title phplib-7.2的问题 帮我看看这段登录验证代码错在哪儿呢 知道哪里有php连IMAP邮件服务器的教程吗?? 怎么把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>
的值
请各位大虾指教?