把各个 checkbox 设为不同的 name

解决方案 »

  1.   

    <input type="checkbox" name="checkbox1[]" value="b1">1</td>
                      <td><input type="checkbox" name="checkbox1[]" value="b2">
                        2</td>
                      <td><input type="checkbox" name="checkbox1[]" value="b3">
                        3</td>
                      <td><input type="checkbox" name="checkbox1[]" value="b4">
                        4</td>
                      <td><input type="checkbox" name="checkbox1[]" value="b5">5</td>以数组的形式传过去
      

  2.   

    <form method =posts action=" 传递的页面.php">
     <input type=radio name=vote value="John">John<br>
     <input type=radio name=vote value="Mary">Mary<br>
     <input type=radio name=vote value="Fred">Fred<br>
     <br>
     <input type=submit value="Show results">
     </form>传递的页面.php
    <?
    echo  $vote;
    ?>
      

  3.   

    <script language="javascript">
    <!--
      function funcheck()
      {
        for(var i=0;i<document.all.length;i++)
        {
          if(document.all(i).type == 'checkbox' && document.all(i).checked == true) alert('选中checkbox的value是:'+document.all(i).value );
    value1=document.all(i).value        
    }
    return document.all.value
      }
    //-->
    <form method =posts action="result.php">
    ....
    <INPUT TYPE="hidden" value=funcheck()>
    </form>
      

  4.   

    return document.all.value;  改为:return value1;
      

  5.   

    HTML 页面 命名为 checkbox1[]提交的PHP 页面通过数组可以得到if (is_array($checkbox)){
      print_r($checkbox);
    }
      

  6.   

    我把数组传过去后,要通过OR的关系,以这个value值查询数据库,那个查询语句怎么针对数组来写?

    select * form datebase where bb=$vote
    好像不对吧
      

  7.   

    if (is_array($checkbox)){
      print_r($checkbox);
    }输出 
    得这个Array ( [0] => a2 [1] => a3 [2] => a4 )  问题是我怎么把这些数提出来做为查询条件呢?
      

  8.   

    原来你什么都想要?$checkbox[0] =a2
    $checkbox[1] =a3
    $checkbox[2] =a4