checkboxes and loops

From: Date: Mon, 29 Mar 2004 05:45:28 +0000
Subject: checkboxes and loops
Groups: php.db 
Request: Send a blank email to php-db+get-33677@lists.php.net to get a copy of this message
OK lets see if I can figure out how to ask this: I am setting up a system for my company to filter through employee applications. Most of the applications do not fit the criteria and I want to allow my bosses a checkbox to the right of them which they can check or uncheck to remove an applicant. So I run a loop that generates a bunch of check boxes with the name box1, box2, box3... by running a loop that runs this and increments counter every time: { <input type = "checkbox" name = "box<?echo $counter;?>" value = "delete"> $counter++; } But when I try to create my query that updates the table I have a problem generating these variable again by referring to them indirectly: *********Bad solution 1 (to much work)*********** if ($box1 == 'delete') <<do whatever>> if ($box2 == 'delete') <<do whatever>> if ($box3 == 'delete') <<do whatever>> if ($box4 == 'delete') <<do whatever>> if ($box5 == 'delete') <<do whatever>> if ($box6 == 'delete') <<do whatever>> ******************************************* *********Bad solution 2 (doesn't work)*********** $counter = 1; while (<<whatever>>) { if ($box . $counter == 'delete') <<do whatever>> $counter++; } ******************************************* How do I get around this problem? Hopefully someone understands what I am trying to say. Matt

« previous php.db (#33677) next »