我有4组单选按钮,这些按钮不会被选中。用户然后需要检查每个组的一个单选按钮。当我提交这个表单时,我得到的错误是,例如,picture_6.tif
传递的值是NULL
。单选按钮被检查,但是将NULL传递给数据库
我正在使用CodeIgniter,并通过POST提交表单。 我想知道你是否可以告诉我我做错了什么。
<form action="/log" method="post" accept-charset="utf-8">
<table class="static">
<tbody>
<tr>
<td><input type="radio" name="picture_6.tif" value="0" class=""></td>
<td><input type="radio" name="picture_7.tif" value="0" class=""></td>
<td><input type="radio" name="picture_8.tif" value="0" class=""></td>
<td><input type="radio" name="picture_9.tif" value="0" class=""></td>
</tr>
<tr>
<td><input type="radio" name="picture_6.tif" value="1" class=""></td>
<td><input type="radio" name="picture_7.tif" value="1" class=""></td>
<td><input type="radio" name="picture_8.tif" value="1" class=""></td>
<td><input type="radio" name="picture_9.tif" value="1" class=""></td>
</tr>
<tr>
<td><input type="radio" name="picture_6.tif" value="2" class=""></td>
<td><input type="radio" name="picture_7.tif" value="2" class=""></td>
<td><input type="radio" name="picture_8.tif" value="2" class=""></td>
<td><input type="radio" name="picture_9.tif" value="2" class=""></td>
</tr>
<tr>
<td><input type="radio" name="picture_6.tif" value="3" class=""></td>
<td><input type="radio" name="picture_7.tif" value="3" class=""></td>
<td><input type="radio" name="picture_8.tif" value="3" class=""></td>
<td><input type="radio" name="picture_9.tif" value="3" class=""></td>
</tr>
<tr>
<td><input type="radio" name="picture_6.tif" value="9" class=""></td>
<td><input type="radio" name="picture_7.tif" value="9" class=""></td>
<td><input type="radio" name="picture_8.tif" value="9" class=""></td>
<td><input type="radio" name="picture_9.tif" value="9" class=""></td>
</tr>
</tbody>
<tbody>
<tr>
<td>
<div>
<input type="submit" name="mysubmit" value="Submit Post!">
</div>
</td>
</tr>
</tbody>
</table>
</form>
编辑:只是增加这使其更容易进行搜索。由于在name
属性中使用句点而产生错误。
如果用户必须检查每个组的一个按钮,那么您需要更改每个组的命名。您对所有 –
都使用相同的方法,但是如何提供我需要的选项?例如,对于'picture_6.tif'组,用户需要从其中一个单选按钮(每个都有不同的值)中进行选择。其他组也一样。更改名称将不会提供该功能,除非我失去了一些东西。 – pepe
将'value =“0”'解释为'null'有问题,所以我们需要看到PHP找到确切的原因 –