Forum Moderators: coopster
[input type="checkbox" name="choiceX" value="yes"]
NOTE: X is a number that increments by 1 for each checkbox. So the first checkbox is called "choice1", the second is called "choice2" and so on.
So how do I take these checkbox variables (choice1, choice2, et cetera) and access a different one each time a loop runs? I want to run a loop which will get the value of each checkbox and - if the checkbox is ticked - will then add text to a list. I'm hoping for something that accomplishes this:
if (isset($choice1)) {
echo "Choice 1<br>"
}
if (isset($choice2)) {
echo "Choice 2<br>"
}
But accomplishes it via a loop so that the "if" statement is written once and the "if" statement tests a different variable each time. Any ideas? Sorry if this message is a bit incoherent, just let me know and I'll try to explain some more.