Re: PHP checkbox/hidden field question
| From: | Erwin | Date: | Mon, 02 Sep 2002 07:37:45 +0000 |
| Subject: | Re: PHP checkbox/hidden field question | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-114880@lists.php.net to get a copy of this message | ||
> I am executing the follwoing statement as part of a "while" loop.
> This is part of a form and I wish to pass the name and value of the
> checkbox as a hidden field only is the checkbox is checked. Can you
> suggest how I can accomplish this task?
>
>
> <td><input type="checkbox" name="d_c_arr[]" value="<?php
> echo
> $db->f("order_id") ?>"></td>
As you might know, checkboxes don't have the VALUE attribute. HTML won't
even submit the VALUE attribute to the next page. You will only have an
array containing 0's and 1's, the results of the checkboxes. So, on the next
page, you will have to lookup the values again.
Then print the hidden input's to the page in a for loop, while looping
trough $d_c_arr.
HTH
Erwin