I have a list of 20 radio buttons, named "1", "2", "3"... "20" that are being submitted via a php form and the POST method.
When I capture the variables, I want to be able to execute a while loop that will print out all the values selected by the radio buttons... only I don't want to explicitly define all of them. I want to run something like this:
while ($loop < $count)
{
print $_POST[$loop];
$loop++;
}
$_POST variable - Looping through numbered arguments
Moderator: General Moderators
-
smcallister
- Forum Newbie
- Posts: 2
- Joined: Fri May 23, 2008 9:48 am
- jaoudestudios
- DevNet Resident
- Posts: 1483
- Joined: Wed Jun 18, 2008 8:32 am
- Location: Surrey
Re: $_POST variable - Looping through numbered arguments
Do you mean something like this...
Code: Select all
foreach ($POST AS $k=>$v) {
echo $k." --- ".$v;
}