I am working with forms (specifically , checkboxes) and am running into an issue that I can't figure out for the life of me.
Here's the code for the forms...
<input type="checkbox" name="questions[]" value="1" /> 1989<br />
<input type="checkbox" name="questions[]" value="0" /> 1991<br />
<input type="checkbox" name="questions[]" value ="1" /> 1990 <br />
<input type="checkbox" name="questions[]" value ="1" /> 2004</p>
As you can see, there are 3 correct answers (value is '1') and 1 incorrect answer.
Here is the php code...
<?php
$questions = $_POST["questions"];
if(is_array($questions))
{
echo 'Great Job!';
}
else
{
echo 'Nada';
}
?>
Here's my issue. If the user clicks on any of the correct answers (but not all of them), they get positive feedback. Further, even if they click on the wrong answer (but click 1 or all of the correct answers), they get positive feedback.
Is it possible to check the value of each form in the array and have that be what is checked in the conditional statement?
I know I can do this without an array, but I'm trying to stay away from writing thousands of if/else statements.
Thanks so much for your help!!!