I am also having a difficult time with radio buttons. I have code that when a checkbox is checked three radio buttons appear and when it is unchecked they go away. However when I click the calculate button (which goes to the second form on my page) the box remains checked but the buttons are gone. Unless one of the radio buttons is checked then that single one remains. Also if I click recalculate again the checkbox gets unchecked. Here is my code for form 1:
<td width="100"><input type="checkbox" name="staple" value="NS" onClick="if(this.checked) {document.getElementById('radio_staple1').style.display = 'block'; document.getElementById('radio_staple2').style.display = 'block'; document.getElementById('radio_staple3').style.display = 'block'; advanced_options();} else {document.getElementById('radio_staple1').style.display = 'none'; document.getElementById('radio_staple2').style.display = 'none'; document.getElementById('radio_staple3').style.display = 'none'; advanced_options();}">Stapling</td>
<td width="100" style="display: none" id="radio_staple1"><input type="radio" name="staple_options" value="H">Horizontal</td>
<td width="100" style="display: none" id="radio_staple2"><input type="radio" name="staple_options" value="V">Vertical</td>
<td width="100" style="display: none" id="radio_staple3"><input type="radio" name="staple_options" value="D" >Diaganol</td>
And for form 2:
<td width="100"><input type="checkbox" name="staple" onClick="if(this.checked) {document.getElementById('radio_staple1').style.display = 'block'; document.getElementById('radio_staple2').style.display = 'block'; document.getElementById('radio_staple3').style.display = 'block'; advanced_options();} else {document.getElementById('radio_staple1').style.display = 'none'; document.getElementById('radio_staple2').style.display = 'none'; document.getElementById('radio_staple3').style.display = 'none'; advanced_options();}"<?php if($POST['staple'] == 'NS') echo 'checked';?>>Stapling</td>
<td width="100" <?php if($POST['staple_options'] == 'H') echo 'style="display: block"'; else echo 'style="display: none"'; ?> id="radio_staple1"><input type="radio" name="staple_options" value="H" <?php if($POST['staple_options'] == 'H') echo 'checked';?>>Horizontal</td>
<td width="100" <?php if($POST['staple_options'] == 'V') echo 'style="display: block"'; else echo 'style="display: none"'; ?> id="radio_staple2"><input type="radio" name="staple_options" value="V"<?php if($POST['staple_options'] == 'V') echo 'checked';?>>Vertical</td>
<td width="100" <?php if($POST['staple_options'] == 'D') echo 'style="display: block"'; else echo 'style="display: none"'; ?> id="radio_staple3"><input type="radio" name="staple_options" value="D" <?php if($_POST['staple_options'] == 'D') echo 'checked';?>>Diaganol</td>
How do I resolve these problems?