Hi,
Try:
$counter = 1;
while (<<whatever>>)
{
$varname = 'box'.$counter;
if ($$varname == 'delete') <<do whatever>>
$counter++;
}
Hth Henrik Hornemann
-----Oprindelig meddelelse-----
Fra: matthew perry [mailto:[EMAIL PROTECTED]
Sendt: 29. marts 2004 07:45
Til: [EMAIL PROTECTED]
Emne: [PHP-DB] checkboxes and loops
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
--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php