You are here: Re: [SMARTY] checkboxes and "checked" retained « Smarty Templates Posts « IT news, forums, messages
Re: [SMARTY] checkboxes and "checked" retained

Posted by Boris Alet on 08/27/05 01:14

Hello,
you must do your "if condition" on $_POST['outreach'] like this :

if (isset($_POST['outreach'])) {

because if register_globals is off in your php config,

isset($outreach) = false

++
Boris

Margie New a écrit :

>I'm trying to get form "checked" checkboxes to remain checked after a submit when the form reappears to the user with error messages. The form doesn't retain the "checked" condition, as the boxes are empty after the form page re-launches.
>
>Here is my php/smarty code:
>
> if (isset($outreach)) {
> for ($i=0; $i <= count($_POST['outreach']) - 1; $i++) {
> $outreach[$i] = trim($_POST['outreach'][$i]);
> $_SESSION['outreach'] = $outreach[$i];
> }
> $smarty->assign('outreach',$_SESSION['outreach']);
> }
>
>
>Here is the html w/smarty code:
>
> <td align="left"><input type="checkbox" name="outreach[]" value="Summer_reading_club00" id="Summer_reading_club00"
> {if !empty($outreach.Summer_reading_club00)} checked="checked" {/if} />
> Summer reading club </td>
>
>
>
>Would appreciate any help. Thanks.
>-- Margie
>
>
>

 

Navigation:

[Reply to this message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация