PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!
Probably the easiest way would be to change those two <input> elements to be type="button" and then put your next page as the jump page in the onClick event of the Yes button, and do whatever you want for the No button. You could also put the checkboxes inside a <form> element, and add a Submit button, and make the next page the action= value of the form. Then in the next page, you could check to see which checkbox had been checked and only display the rest of the page if the Yes button had been checked.
I can't understand what you're doing there, since all you have shown is how to construct a long string, and I have no idea why.
If you're already creating a form and submitting it to another script, then in that script you could also check which of the checkboxes were checked, doing that even before any other validation. If the Yes box was not checked, you could send the user to a "Not Authorized" page or something.
<?php
if(isset($_POST['otherInfoArray[cprattestyes]']) {
echo "OK, you can continue";
} else {
echo "You did not accept":
header('Location: http://www.example.com/');
}
... // rest of your script, if successful
If I were writing the script, I don't think I would use array elements as names for HTML elements, it just complicates the programming. And why would it be important to know the difference between nothing checked and "No" checked? You're going to take the same action in either case, aren't you? Why not just leave off the No checkbox? That's just inviting the user to make a mistake by checking the wrong box. Presumably no one should ever think they are supposed to check the No box.