用慣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()"/>