Re: Checkboxes in a table

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

 



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" <mguirao@xxxxxxxxxxxx> wrote in message
news:001e01c4870e$67a0a650$0500a8c0@xxxxxxxxxxxxxxx
> 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


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

  Powered by Linux