scheols Posted July 30, 2006 Share Posted July 30, 2006 so um you know how you have button inputs and you can do a check with if statementif(isset($buttonname)){//do somthen}else{//do somthencan you do this for radio buttons? and how does it work with check boxes?the isset check Quote Link to comment https://forums.phpfreaks.com/topic/16002-um-inputes-quick-question/ Share on other sites More sharing options...
tomfmason Posted July 30, 2006 Share Posted July 30, 2006 ok here you goa simple form with three check boxes with the isset submit[code=php:0]<?phpif (isset(submit) { if (!$test) { //the name of the checkbox echo "You did not check a box"; exit; }//do something} ?><form method="POST" action="whatever.php"><input type="checkbox" name="test" value="test"> test<br><input type="checkbox" name="test" value="test2"> test2<br><input type="checkbox" name="test" value="test3"> test3<br><p><input type="submit" value="Submit" name="submit"></p></form>[/code]Hope this helps,Tom Quote Link to comment https://forums.phpfreaks.com/topic/16002-um-inputes-quick-question/#findComment-65775 Share on other sites More sharing options...
king arthur Posted July 30, 2006 Share Posted July 30, 2006 Actually, you need to give the checkboxes different names, otherwise you will only get the value of the last one, unless you call them "test[]" for example, then you get an array with their values. With radio buttons, you give each radio button in the set the same name but different values, and the variable with the corresponding name will have the value of whichever one is selected. Quote Link to comment https://forums.phpfreaks.com/topic/16002-um-inputes-quick-question/#findComment-65796 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.