<input type="checkbox" name="check_id[]" value="XX">

解决方案 »

  1.   

    这样一来该怎么实现全选的功能呢?
    <script language="javascript">
    function checkAll(){
       var iLeng = document.form1.check_id.length;
       for(i=0;i<iLeng;i++){
    if(document.getElementById("checkAll").checked){
    document.form1.check_id[i].checked = true;
    }
    else{
    document.form1.check_id[i].checked = false;
    }
    }
    }
    </script>
    这样写似乎有错误
      

  2.   

    if(!document.getElementById("checkAll").checked){
    document.form1.check_id[i].checked = true;
    }
      

  3.   

    checkbox的名字改成check_id[]
    然后在js操作这个对象就可以了
    var obj=document.getElementsById("check_id[]");
      

  4.   

    我这问题我前面也不知道,如果表单域同名php需要序列化为数组就是在表单name加上[]!
    http://www.kuomart.com/blog
      

  5.   

    好了,前台全选实现了。php怎么接收该数据?
    $pig = $_POST['check_id'];
    echo $pig;输出为:array
    怎么办?
      

  6.   

    print_r($pig);看看
    现在你的$pig已经是数组了,里面的元素就是选中所有的值,该怎么处理怎么处理了撒
      

  7.   

    var_dump($check);
    看到什么了?
    LZ认为mysql会如何操作这样的数据呢 ?
    呵呵~~~
      

  8.   

    //将数据转换成字符串
    foreach($check as $str){
      $idstr .= $str.",";
    }
    //去掉生成的字符串最后多出来的一个","
    $idstr = substr($idstr,0,-1);$sql ="update table set area1=xx where id in(".$idstr.")";
    mysql_query($sql);
      

  9.   

    前台保存到隐藏域中如下
     var strchoice="";
     if(CheckKey.checkbox[0]==undefined){    
       if(CheckKey.checkbox.checked==true){
         strchoice=CheckKey.checkbox.value;
     }else{
       strchoice="";
     }  
      }else{   
      for(i=0;i< CheckKey.checkbox.length;i++){ 
        if (CheckKey.checkbox[i].checked==true){ 
           strchoice=strchoice+CheckKey.checkbox[i].value+","; 
          } 
      } 
       strchoice=strchoice.substring(0,strchoice.length-1);
     }
      

  10.   

    CheckKey.checkboxh.value=strchoice;  //给隐藏域赋值;