我對編輯的通知,看起來像一個形式:如何通過POST PHP腳本訪問複選框,當有相同的形式多個複選框
<form action='edit.php' method = 'post'>
<b> Username</b>:<br/> <input type='text' name ='username' value ="<?=$username?>" /><br/>
<input type = "checkbox" id="r_notif" name="r_notif" checked="yes" /> Response Notifications<br/>
<input type = "checkbox" id="c_notif" name="c_notif" checked="yes" /> Comment Notifications<br/>
<input type ='submit' value = 'SEND' />
</form>
在edit.php
,我想設置的值$ r_notif爲1
,如果checked ="yes"
用於名稱爲resp_notif
的輸入。同樣,如果輸入c_notif
的輸入爲checked = "yes"
,我想將$c_notif
的值設置爲1
。在每種情況下,我都將它們設置爲零。
問題是,我只知道如何訪問$_POST['name_of_field']
,不知道如何訪問檢查值...如何才能做到這一點(在PHP
或其他方式)
謝謝!