Re: Checking Chechboxes :)
| From: | Monty | Date: | Fri, 18 Apr 2003 20:22:31 +0000 |
| Subject: | Re: Checking Chechboxes :) | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-144433@lists.php.net to get a copy of this message | ||
You need to load the checkbox results from your DB into an array, and then
simply use the following example to make the checkboxed checked or unchecked
based on the results...
<input type="checkbox" name="array[name1]" value="1"<? if
($array['name1']==1) echo ' checked'; ?>>
> From: lists@dharik.com (Daniel Harik)
> Newsgroups: php.general
> Date: Fri, 18 Apr 2003 18:54:52 +0000
> To: php-general@lists.php.net
> Subject: Checking Chechboxes :)
>
> Hello,
>
> I have following problem, i have form with 64 checkboxes,and
> in database i store which ones are checked, how can i make them
> checked on form based on database results. I know i could
> loop throug them, but that would be around 20-30 loops for 64 items,
> maybe it's too CPU hungry?
>
> Thank you very much.
> Have a nice Easter.
>