我有4组无线电按钮,这些按钮未经检查呈现给用户。然后,用户需要为每个组检查一个单选按钮。当我提交此表单时,我得到的错误是,例如,对于picture_6.tif
,传递的值为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>
&#13;
编辑:只需添加此内容即可轻松进行搜索。使用name
属性中的句点会产生错误。
答案 0 :(得分:3)
您将radio
name="picture_6.tif"
和您的参数命名为$_POST["picture_6_tif"]
。注意:不 $_POST["picture_6.tif"]
。后者在未定义时为null。
<?php
var_dump($_POST);
?>
//array(5) { ["picture_7_tif"]=> string(1) "1" ["picture_6_tif"]=> string(1) "2" ["picture_8_tif"]=> string(1) "3" ["picture_9_tif"]=> string(1) "9" ["mysubmit"]=> string(12) "Submit Post!" }