Re: [SMARTY-DEV] Checkbox syntax
| From: | Monte Ohrt | Date: | Mon, 05 May 2003 19:19:14 +0000 |
| Subject: | Re: [SMARTY-DEV] Checkbox syntax | ||
| References: | 1 | Groups: | php.smarty.dev |
| Request: | Send a blank email to php-smarty-dev+get-1357@lists.php.net to get a copy of this message | ||
Use an array instead of separately named checkboxes:
<input type="checkbox" name="mychecks[]" value="{$mychecks[foo]}"
{if
..}checked="checked"{/if}>
On Mon, 2003-05-05 at 14:15, luis wrote:
> Let's suposse I have checkboxes inside a section loop so the "name" of
> each checkbox is:
> <input type="checkbox" name="{elements[$foo[ix]]}" />
>
> I want to preserve checked boxes when processing a form in the script ..
> Tried something like..
>
> <input type="checkbox" name="{elements[$foo[ix]]}" {if
> $smarty.request.elements[$foo[ix]]}checked="checked"{/if} />
>
> but it doesn't work.
> Which is the best way to do this? Maybe I'm overlooking something more
> elegant..
>
> Luis
>
--
Monte Ohrt <monte@ispi.net>