I suggest using a javascript as suggested by other users.
If you want to use only PHP and HTML you can use the following solution.
I write it, but I would not use this solution on a production environment.
<input type='hidden' name='checkboxvar[1]' value="0" />
<input type='checkbox' name='checkboxvar[1]' value='Option One' />1<br />
<input type='hidden' name='checkboxvar[2]' value="0" />
<input type='checkbox' name='checkboxvar[2]' value='Option Two' />2<br />
<input type='hidden' name='checkboxvar[3]' value="0" />
<input type='checkbox' name='checkboxvar[3]' value='Option Three' />3
In the $_POST array you should have something like that if Option One is selected.
Array
(
[1] => Option One
[2] => 0
[3] => 0
)
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…