【发布时间】:2017-09-20 18:03:12
【问题描述】:
在一个页面上,我有大约 40 个复选框。只有最后一个可以在我的 android-browser 上运行。在我的电脑(Internet Explorer、chrome、Firefox)上一切正常。
请看这里: stufentheorie.de / tonart-bestimmen.html
代码如下:
<form action='' method='post' role='form'>
<div class="row">
<div class="col-md-4">
<p> </p>
<h3>Dur-Akkorde</h3>
<?
$i = "0";
foreach ($toene as $ton)
{
$wert = $ton . " " . $geschlecht[0];
$ch = '';
if (is_array($input_chord) == true)
{
if (in_array($wert, $input_chord))
{
$ch = " checked=\"checked\"";
}
}
echo "<span style=\"width:120px;display:block;float:left;\"><input type=\"checkbox\" name=\"akkord[".$wert."]\" value=\"" . $wert . "\"" . $ch . "> " . $wert . " </span>";
$i ++;
if ($i % 6 == 0)
{
echo "";
}
}
?>
</div>
<div class="col-md-4">
<br style="clear:left;" />
<h3>Moll-Akkorde</h3>
<?
$i = "0";
foreach ($toene as $ton)
{
$wert = $ton . " " . $geschlecht[1];
$ch = '';
if (is_array($input_chord) == true)
{
if (in_array($wert, $input_chord))
{
$ch = " checked=\"checked\"";
}
}
echo "<span style=\"width:120px;display:block;float:left;\"><input type=\"checkbox\" name=\"akkord[".$wert."]\" value=\"" . $wert . "\"" . $ch . "> " . $wert . " </span> ";
$i ++;
if ($i % 5 == 0)
{
echo "";
}
}
?>
</div>
<div class="col-md-4">
<br style="clear:left;" />
<h3>Verminderte Akkorde</h3>
<?
$i = "0";
foreach ($toene as $ton)
{
$wert = $ton . " " . $geschlecht[2];
$ch = '';
if (is_array($input_chord) == true)
{
if (in_array($wert, $input_chord))
{
$ch = " checked=\"checked\"";
}
}
echo "<span style=\"width:120px;display:block;float:left;\"><input type=\"checkbox\" name=\"akkord[".$wert."]\" value=\"" . $wert . "\"" . $ch . "> " . $wert . " </span> ";
$i ++;
if ($i % 3 == 0)
{
echo "";
}
}
?>
</div></div>
<br /> <br />
<div class="col-md-4 col-md-offset-4"><input type='submit' class='btn btn-block btn-lg btn-theme' value='Tonart bestimmen'/></div></form>
为什么浏览器只能使用最后一个复选框“verminderte Akkorde”?
所有复选框的代码完全相同。
感谢您的帮助!
【问题讨论】:
-
请用开发者术语解释“工作”。究竟发生了什么,或没有发生?
-
您不能选中第一个复选框。只有最后一个是可选的。
-
据我所知,您正在创建大量它们,但都具有相同的名称 -
akkord[]。尝试在[]数组部分中添加一些内容,以使每个复选框的名称不同。 -
您能否重新格式化您的代码,使其不包含
>针脚? -
改成
<span style=\"width:120px;display:block;float:left;\"><input type=\"checkbox\" name=\"akkord[".$wert."]\" value=\"" . $wert . "\"" . $ch . "> " . $wert . " </span> ";还是不行。