almightyegg Posted March 29, 2008 Share Posted March 29, 2008 I wasn't sure how to check whether checkboxes had been checked, so I did this: $pinned = $_POST['pinned']; $locked = $_POST['locked']; if(!$pinned){ $pinned = No; }elseif(!$locked){ $locked = No; }elseif(isset($locked)){ $locked = Yes; }elseif(isset($pinned)){ $pinned = Yes; } $locked and $pinned are checkboxes from a form on the previous page. It sets to No when the boxes aren't checked but when they are checked it stays at "on" and even when I tried: if($locked == on){ etc.. it still had no affect Any help would be greatly received. Quote Link to comment https://forums.phpfreaks.com/topic/98487-php-and-checkboxes/ Share on other sites More sharing options...
MadTechie Posted March 29, 2008 Share Posted March 29, 2008 <?php //if its set then its check $pinned = (isset($_POST['pinned'])); $locked = (isset($_POST['locked'])); if($pinned) echo "pinned checked"; if($locked) echo "lockedchecked"; //debuger echo "debuger<br><pre>"; print_r($_POST); ?> Quote Link to comment https://forums.phpfreaks.com/topic/98487-php-and-checkboxes/#findComment-504029 Share on other sites More sharing options...
almightyegg Posted March 29, 2008 Author Share Posted March 29, 2008 Awesome! Worked great Thnaks Quote Link to comment https://forums.phpfreaks.com/topic/98487-php-and-checkboxes/#findComment-504042 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.