Using if statements with checkboxs

Greetings,

I have several checkboxes - and if one is chosen, I would like to display certain radio buttons.
I have a system that works using javascript and visibility options, but each set of radio buttons take up a line of space whether they are visible or not. So when nothing is selected there is this empty massive space.


.
.
<div id="myGroup8" style="visibility: hidden;"> [COLOR=#000000][COLOR=#0000bb]<?php [/COLOR][COLOR=#007700]include ([/COLOR][COLOR=#dd0000]"x1.html"[/COLOR][COLOR=#007700]); [/COLOR][COLOR=#0000bb]?>[/COLOR][/COLOR] </div>
<div id="myGroup9" style="visibility: hidden;"> [COLOR=#000000][COLOR=#0000bb]<?php [/COLOR][COLOR=#007700]include ([/COLOR][COLOR=#dd0000]"x2.html"[/COLOR][COLOR=#007700]); [/COLOR][COLOR=#0000bb]?>[/COLOR][/COLOR] </div>
.
.
<form><input type="checkbox" onclick="toggle(this, 'myGroup7')" setVisibility('myGroup7','collapse'); name="x1" value="[COLOR=#000000][COLOR=#0000bb]<?php [/COLOR][COLOR=#007700]if(isset([/COLOR][COLOR=#0000bb]$_POST[/COLOR][COLOR=#007700][[/COLOR][COLOR=#dd0000]'x1'[/COLOR][COLOR=#007700]])) echo [/COLOR][COLOR=#dd0000]'checked="checked"'[/COLOR][COLOR=#007700];[/COLOR][COLOR=#0000bb]?>[/COLOR][/COLOR]"> x1
<input type="checkbox" onclick="toggle(this, 'myGroup8')" setVisibility('myGroup8','collapse'); name="x2" value="[COLOR=#000000][COLOR=#0000bb]<?php [/COLOR][COLOR=#007700]if(isset([/COLOR][COLOR=#0000bb]$_POST[/COLOR][COLOR=#007700][[/COLOR][COLOR=#dd0000]'x2'[/COLOR][COLOR=#007700]])) echo [/COLOR][COLOR=#dd0000]'checked="checked"'[/COLOR][COLOR=#007700];[/COLOR][COLOR=#0000bb]?>[/COLOR][/COLOR]"> x2</form>
.
.

I would prefer using php to accomplish this task - something like below (but that actually works)…


if(isset($_POST['x1']))
   include ("x1.html");


<input type="checkbox" onclick="???; name="x1" value="[COLOR=#000000][COLOR=#0000bb]<?php [/COLOR][COLOR=#007700]if(isset([/COLOR][COLOR=#0000bb]$_POST[/COLOR][COLOR=#007700][[/COLOR][COLOR=#dd0000]'x1'[/COLOR][COLOR=#007700]])) echo [/COLOR][COLOR=#dd0000]'checked="checked"'[/COLOR][COLOR=#007700];[/COLOR][COLOR=#0000bb]?>[/COLOR][/COLOR]"> x1

This is not going into a database, these actions must occur on the onclick (i.e. not on a submit button), and I would like the space to expand/contract depending on checkbox states. Any assistance is greatly appreciated.

  • c