Loops inside form processing
Posted: Fri Sep 15, 2006 5:39 am
Hi there,
I'm trying to get a loop to cycle through a series of check boxes. I've had no problem naming the checkboxes using a loop, but when I come to get the information out i.e. using $_POST['stuff'] I'm not sure where or how to put in the syntax for the loop variable.
Here's my code as it stands (not working):
The checkboxes are named 'sendTo1','sendTo2' etc etc., and it's just the $i and where to put it thats puzzling.
I'm sure it will only be a couple of characters I'm looking for, so any help would be much appreciated.
Thanks.
I'm trying to get a loop to cycle through a series of check boxes. I've had no problem naming the checkboxes using a loop, but when I come to get the information out i.e. using $_POST['stuff'] I'm not sure where or how to put in the syntax for the loop variable.
Here's my code as it stands (not working):
Code: Select all
for ($i = 0; $i < $count; $i++)
{
if($_POST['sendTo' . $i] != NULL)
{
print($_POST['sendTo' . $i] . "<br/>");
}
}I'm sure it will only be a couple of characters I'm looking for, so any help would be much appreciated.
Thanks.