php,checkbox多選框上傳失敗

用慣java和其他語言的時候,表單上傳只需要checkbox的name相同的時候就可以上傳了

<input type="checkbox" name="checkbox" value="1"> 選項1
<input type="checkbox" name="checkbox" value="2"> 選項2
<input type="checkbox" name="checkbox" value="3"> 選項3

<input type='button' value='確定' onclick="fun()"/>

但是php卻只有在這種情況下,name要寫成數組形式才能正常表單提交

<input type="checkbox" name="checkbox[]" value="1"> 選項1
<input type="checkbox" name="checkbox[]" value="2"> 選項2
<input type="checkbox" name="checkbox[]" value="3"> 選項3
<input type="checkbox" name="checkbox[]" value="4"> 選項4
<input type="checkbox" name="checkbox[]" value="5"> 選項5
<input type="checkbox" name="checkbox[]" value="6"> 選項6
<input type='button' value='確定' onclick="fun()"/>
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章