chris_rulez001 Posted July 25, 2007 Share Posted July 25, 2007 hi im making a forum hosting sevice, and i would like to know how do i make it so if the checkbox is unticked they cant register. heres what i have: <?php $tos = $_POST['tos']; if ($tos == "Unchecked" || $tos == "") { //the code carries on is the above how you would check if the checkbox is unticked? Quote Link to comment Share on other sites More sharing options...
pedrobcabral Posted July 25, 2007 Share Posted July 25, 2007 if the checkbox is diferent from "on" it is not ticked. Quote Link to comment Share on other sites More sharing options...
chris_rulez001 Posted July 25, 2007 Author Share Posted July 25, 2007 if the checkbox is diferent from "on" it is not ticked. i dont understand what you mean Quote Link to comment Share on other sites More sharing options...
teng84 Posted July 25, 2007 Share Posted July 25, 2007 use the isset if (isset($_POST['chk'])){ then do anything here } Quote Link to comment Share on other sites More sharing options...
pedrobcabral Posted July 25, 2007 Share Posted July 25, 2007 Right, you just want also to put a ! before the word "isset". Quote Link to comment Share on other sites More sharing options...
chris_rulez001 Posted July 25, 2007 Author Share Posted July 25, 2007 ok thanks both of you for your help Quote Link to comment Share on other sites More sharing options...
redarrow Posted July 25, 2007 Share Posted July 25, 2007 try this to get the concept correct ok. <?php if(isset($_POST['submit'])){ if(empty ($one)){ echo "<br><br>unchecked 1<br><br>"; }else{ echo "<br><br>checked 1<br><br>"; } if(empty ($two)){ echo "<br><br>unchecked 2<br><br>"; }else{ echo "<br><br>checked 2<br><br>"; } if(empty ($three)){ echo "<br><br>unchecked 3<br><br>"; }else{ echo "<br><br>checked 3<br><br>"; } if(empty ($four)){ echo "<br><br>unchecked 4<br><br>"; }else{ echo "<br><br>checked 4<br><br>"; } } ?> <form method="POST" action="<?php echo $_SERVER['PHP_SELF'] ?>"> <br><br> check box 1 <input type="checkbox" name="one"> <br><br> check box 2 <input type="checkbox" name="two"> <br><br> check box 3 <input type="checkbox" name="three"> <br><br> check box 4 <input type="checkbox" name="four"> <br> <br> <input type="submit" name="submit" value="cheek"> </form> Quote Link to comment Share on other sites More sharing options...
rlindauer Posted July 25, 2007 Share Posted July 25, 2007 Wouldn't your example require register globals to be enabled? 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.