常见的复选表单,如果我按照常规的提交的话只能提交进去第一个选中的选项。如何把我所选中的选项全部提交进去?
然后怎么再把那些复选的数据全部取出来呢、?

解决方案 »

  1.   


    <form name="zhuce" action="zhuce.php" method="post">
        <input type="checkbox" value="开幕式 + 主题论坛:推动"气体能源"开发与利用论坛" name="chxx" />
        <input type="checkbox" value="气体能源产业政策专题研讨会" name="chxx" />
        <input type="checkbox" value="气体能源产业国际前沿技术推介会" name="chxx" />
        <input type="checkbox" value="项目投融资路演暨项目投融资推介洽谈会" name="chxx" />
        <input type="checkbox" value="大中型沼气工程建设和运营经验交流会" name="chxx" />
        <input type="checkbox" value="项目考察" name="chxx" />
       <input type="submit" value="注册" name="submit" style="width:70px; height:26px; line-height:26px; border:#999 1px solid; cursor:pointer"/>  
       <input type="reset" value="清除" name="Submit2" style="width:70px; height:26px; line-height:26px; border:#999 1px solid; margin-left:30px; cursor:pointer"/>
    </form>
      

  2.   

    如果只是insert into chxx $_POST[chxx]的话只能插入我复选的第一个值。
    应该是数组的问题吗?怎么解决?
      

  3.   


    <form name="zhuce" action="zhuce.php" method="post">
        <input type="checkbox" value="开幕式 + 主题论坛:推动"气体能源"开发与利用论坛" name="chxx[]" />
        <input type="checkbox" value="气体能源产业政策专题研讨会" name="chxx[]" />
        <input type="checkbox" value="气体能源产业国际前沿技术推介会" name="chxx[]" />
        <input type="checkbox" value="项目投融资路演暨项目投融资推介洽谈会" name="chxx[]" />
        <input type="checkbox" value="大中型沼气工程建设和运营经验交流会" name="chxx[]" />
        <input type="checkbox" value="项目考察" name="chxx[]" />
       <input type="submit" value="注册" name="submit" style="width:70px; height:26px; line-height:26px; border:#999 1px solid; cursor:pointer"/>  
       <input type="reset" value="清除" name="Submit2" style="width:70px; height:26px; line-height:26px; border:#999 1px solid; margin-left:30px; cursor:pointer"/>
    </form>然后在zhuce.php页面用:$_POST['chxx']接收,即为复选框选中的值。
      

  4.   

    print_r($_POST['chxx']);有选中的值吗?
      

  5.   


    可能是我没说清楚,print_r($_POST['chxx']);是可以输出数组,但是写进数据库的只有一个Array。
    如何才能把复选值全部写进去?
      

  6.   

    echo join(',', $_POST['chxx']);你自己看