dongshuming7131 2013-12-09 13:27
浏览 107

复选框取消选中IE10 + IE11的问题

I have a big problem with IE 10 and checkboxes. I use some checkboxes like this:

<form method="post" action="">
    <input id="trainingseinheit1" type="checkbox" checked="checked" value="1" name="trainingseinheit1"> 1
    <br>
    <input id="trainingseinheit2" type="checkbox" checked="checked" value="2" name="trainingseinheit2"> 2
    <br>
    <input id="trainingseinheit3" type="checkbox" checked="checked" value="3" name="trainingseinheit3"> 3
    <br>
    <input id="trainingseinheit4" type="checkbox" checked="checked" value="4" name="trainingseinheit4"> 4
    <br>
    <input id="trainingseinheit5" type="checkbox" checked="checked" value="5" name="trainingseinheit5"> 5
    <br>
    <input id="trainingseinheit6" type="checkbox" checked="checked" value="6" name="trainingseinheit6"> 6
    <input type="hidden" name="teanzahl" value="6" />
</form>

And after sending I will check with php which checkbox is checked and do something:

$zahl = 1;

while($zahl <= $_POST['teanzahl'])
{
    $tezahl = "trainingseinheit".$zahl;

    if(isset($_POST[$tezahl]))
    {
        // do something ...
    }

    $zahl++;  
}

In Firefox, Chrome etc it works fine. The PHP code realize which elements are checked and which not. But in IE10 and IE11 it thinks that all elements are checked (even if I uncheck all). Another strange thing is, when I echo the value of the checkbox field like this:

echo $tezahl." = ".$_POST[$tezahl]." ... ";

In Firefox it looks like this:

trainingseinheit1 = 1 ... 
trainingseinheit2 = 2 ... 
trainingseinheit3 = 3 ... 
trainingseinheit4 = 4 ... 
...

But in IE10 it looks like this:

trainingseinheit1 = 1 ... 
trainingseinheit2 = 1 ... 
trainingseinheit3 = 1 ... 
trainingseinheit4 = 1 ... 
...

So in IE it is always the value "1". Why that?

I don't know what I have to change for IE. Do you have a idea?

  • 写回答

1条回答 默认 最新

  • douxing2652 2013-12-09 13:42
    关注

    1) Try to change checkbox values, for example, 'a1', 'a2' and etc.

    2) Try to change name of checkboxes to trainingseinheit[] (don't forget to change php)

    评论

报告相同问题?

悬赏问题

  • ¥15 seatunnel-web使用SQL组件时候后台报错,无法找到表格
  • ¥15 fpga自动售货机数码管(相关搜索:数字时钟)
  • ¥15 用前端向数据库插入数据,通过debug发现数据能走到后端,但是放行之后就会提示错误
  • ¥30 3天&7天&&15天&销量如何统计同一行
  • ¥30 帮我写一段可以读取LD2450数据并计算距离的Arduino代码
  • ¥15 飞机曲面部件如机翼,壁板等具体的孔位模型
  • ¥15 vs2019中数据导出问题
  • ¥20 云服务Linux系统TCP-MSS值修改?
  • ¥20 关于#单片机#的问题:项目:使用模拟iic与ov2640通讯环境:F407问题:读取的ID号总是0xff,自己调了调发现在读从机数据时,SDA线上并未有信号变化(语言-c语言)
  • ¥20 怎么在stm32门禁成品上增加查询记录功能