galvin Posted October 21, 2009 Share Posted October 21, 2009 If you have a form with several checkbox options like... <input type='checkbox' class="" name='pooloptions[]' value="one" />1 <input type='checkbox' class="" name='pooloptions[]' value="two" />2 <input type='checkbox' class="" name='pooloptions[]' value="three" />3 <input type='checkbox' class="" name='pooloptions[]' value="four" />4 ... and the form is submitted, you obviously have an array called "pooloptions[]' that holds the value of all options that were checked. But if I want to say, for example, "If the checkbox option with a value of "two" was NOT checked, do this, else, if the option with a value of "two" WAS checked, do this", how would I do that? I know it's simple but I'm confusing myself :-\ Thanks, Greg Quote Link to comment Share on other sites More sharing options...
mikesta707 Posted October 21, 2009 Share Posted October 21, 2009 check boxes that aren't checked don't get submit to the $_POST array you can do something like <input type='checkbox' class="" name='pooloptions[1]' value="one" />1 <input type='checkbox' class="" name='pooloptions[2]' value="two" />2 <input type='checkbox' class="" name='pooloptions[3]' value="three" />3 <input type='checkbox' class="" name='pooloptions[4]' value="four" />4 then you could do if (isset($_POST['pooloptions'][2])){ //do whatever } 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.