Grodo Posted May 9, 2008 Share Posted May 9, 2008 Hello Thanks for looking at my post... So here is the scoop. I have three checkboxes (toolmag,sinkmag,faucetmag). What I am trying to do is have php check if one or more of the checkboxes are checked. I akready got the validation code down now all that is left is to form the IF and Or statement. This is the part im lost one. I know that if statments can have multiple conditions. But how can you tell the if statement if this condition is not met go to the next and when non of the conditions meet go to the else. I know that in Java the operator was ||. Attached below is the checkbox html code as well as the php code for checkbox validation. <input type="checkbox" name="toolmag">Tool Catalog<BR> <input type="checkbox" name="sinkmag">Vanity / Stainless Steel Sink Catalog<BR> <input type="checkbox" name="faucetmag">Faucet Catalog<BR> // CheckBox Tool Cat if($_POST['toolmag']) { $tm=1; } else { $tm=0; } // CheckBox Sink Cat if($_POST['sinkmag']) { $sm=1; } else { $sm=0; } // CheckBox Faucet Cat if($_POST['faucetmag']) { $fm=1; } else { $fm=0; } Quote Link to comment Share on other sites More sharing options...
Grodo Posted May 9, 2008 Author Share Posted May 9, 2008 Ok I figured it out had to use a ghetto if statement (HEY IT WORKS) Still open for suggestions! //Check if one of the boxes is selected If ($tm==1) { // Do Nothing } elseif ($fm==1) { // Do Nothing } elseif ($sm==1) { // Do Nothing } else { $print_again = true; $message[]="Please select a catalog"; } 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.