errcricket Posted December 24, 2009 Share Posted December 24, 2009 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;"> <?php include ("x1.html"); ?> </div> <div id="myGroup9" style="visibility: hidden;"> <?php include ("x2.html"); ?> </div> . . <form><input type="checkbox" onclick="toggle(this, 'myGroup7')" setVisibility('myGroup7','collapse'); name="x1" value="<?php if(isset($_POST['x1'])) echo 'checked="checked"';?>"> x1 <input type="checkbox" onclick="toggle(this, 'myGroup8')" setVisibility('myGroup8','collapse'); name="x2" value="<?php if(isset($_POST['x2'])) echo 'checked="checked"';?>"> 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="<?php if(isset($_POST['x1'])) echo 'checked="checked"';?>"> 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 Quote Link to comment https://forums.phpfreaks.com/topic/186279-using-if-statements-with-checkboxs/ Share on other sites More sharing options...
.josh Posted December 24, 2009 Share Posted December 24, 2009 php is a server-side language, parsed on the server. It cannot do this sort of thing. Quote Link to comment https://forums.phpfreaks.com/topic/186279-using-if-statements-with-checkboxs/#findComment-983788 Share on other sites More sharing options...
errcricket Posted December 24, 2009 Author Share Posted December 24, 2009 Sadly, I completely overlooked that. Dang! Thanks for the reminder. Quote Link to comment https://forums.phpfreaks.com/topic/186279-using-if-statements-with-checkboxs/#findComment-983789 Share on other sites More sharing options...
mikesta707 Posted December 24, 2009 Share Posted December 24, 2009 Instead of using the visibility style, you could use the display style. If you set it to none, then it won't take up any of the space it usually does Quote Link to comment https://forums.phpfreaks.com/topic/186279-using-if-statements-with-checkboxs/#findComment-983815 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.