Re: checkboxes and loops

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi!
I think you should rename checkboxes to box[1], box[2] etc.
So you will get an array $_POST["box"]. I think it will be better.
Best wishes,
Mikhail U. Petrov,
PHP-programmer



Hello matthew,

Monday, March 29, 2004, 9:45:28 AM, you wrote:

mp> OK lets see if I can figure out how to ask this:

mp> I am setting up a system for my company to filter through employee 
mp> applications.  Most of the applications do not fit the criteria and I 
mp> want to allow my bosses a checkbox to the right of them which they can 
mp> check or uncheck to remove an applicant.
mp> So I run a loop that generates a bunch of check boxes with the name 
mp> box1, box2, box3... by running a loop that runs this and increments 
mp> counter every time:
mp> {
mp> <input type = "checkbox" name = "box<?echo $counter;?>" value = "delete">
mp> $counter++;
mp> }

mp> But when I try to create my query that updates the table I have a 
mp> problem generating these variable again by referring to them indirectly:

mp> *********Bad solution 1 (to much work)***********
mp> if ($box1 == 'delete')   <<do whatever>>
mp> if ($box2 == 'delete')  <<do whatever>>
mp> if ($box3 == 'delete')  <<do whatever>>
mp> if ($box4 == 'delete')  <<do whatever>>
mp> if ($box5 == 'delete')  <<do whatever>>
mp> if ($box6 == 'delete')  <<do whatever>>
mp> *******************************************

mp> *********Bad solution 2 (doesn't work)***********
mp> $counter = 1;
mp> while (<<whatever>>)
mp> {
mp> if ($box . $counter == 'delete')   <<do whatever>>
mp> $counter++;
mp> }
mp> *******************************************

mp> How do I get around this problem?
mp> Hopefully someone understands what I am trying to say.

mp> Matt

-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [PHP Users]     [Postgresql Discussion]     [Kernel Newbies]     [Postgresql]     [Yosemite News]

  Powered by Linux