我有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找到確切的原因 –