tyooseph Posted June 25, 2007 Share Posted June 25, 2007 Hello, I have a form with several fields that are required if the user checks a checkbox. I am validating the form and displaying errors on the screen for the user to correct; however, the checkbox does not remain checked if errors are displayed. I've tried searching the Internet for solutions and found the following, which does not work. Am I missing something? Please advise. Thank you. <input type="checkbox" name="showSummary"<?php if($showSummary == 'on'){echo " CHECKED";}?>> Summary Quote Link to comment Share on other sites More sharing options...
obsidian Posted June 25, 2007 Share Posted June 25, 2007 Try this: <?php echo "<input type=\"checkbox\" name=\"showSummary\" "; echo isset($_POST['showSummary']) ? 'checked="checked" ' : ''; echo "/> Summary\n"; ?> Good luck. Quote Link to comment Share on other sites More sharing options...
tyooseph Posted June 25, 2007 Author Share Posted June 25, 2007 Thanks! that did the trick.... Quote Link to comment Share on other sites More sharing options...
mdvignesh Posted April 4, 2012 Share Posted April 4, 2012 Good dude Quote Link to comment 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.