[PHP-DB] Re: Checkboxes in a table

2004-08-20 Thread Jasper Howard
just set the checked value of the check boxes to something like, true, and
when you are going through the check boxes in the second script do something
like this:

$boxes = array();
$num = 0;
foreach ($_POST['checkboxe'] as $box) {
 if ($box == 'true') {
  $boxes[$num] = 'checked';
 } else {
  $boxes[$num] = 'unchecked';
 }
 $num += 1;
}

Now the array $boxes has the values for all the checkboxes, if they were
checked or not.

NOTES: This is just a quick script, I don't know if it'll work for you
perfectly, but you should always start at 0, not 1, so that the first value
in the array is not null.

anyway, hope this helps.


Miguel Guirao [EMAIL PROTECTED] wrote in message
news:[EMAIL PROTECTED]
 Hi!!

 I'm dinamically building a table, within a while cycle a build each row
 with it's columns.
 One of these columns contains a checkbox, so I have as many checkboxes
 as many rows.

 So, after hitting Submit I wanna know which checkboxes has been
 selected, I'm naming each of them  like this: checkbox[n], where n=1 is
 for the first row and so on.

 So, my question is, upon receiving all the variables in the second
 script, if I navigate thru each of the elements, I will see which one is
 selected and which one is not?
 Am I all right??

 Miguel Guirao
 Servicios Datacard
 www.SIASA.com.mx



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



RE: [PHP-DB] Re: Checkboxes in a table

2004-08-20 Thread Ford, Mike [LSS]
 -Original Message-
 From: Ford, Mike   [LSS]
 Sent: 21/08/04 01:57

   foreach ($_POST['checkbox'] as $key=$irrelevant):
 // checkbox[$key] was checked
   endif;

OK, it's 2a.m. here and I'm about asleep, whioch is why that last line
didn't read

endforeach;

!!!

Cheers!

Mike

-- 
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