Checkbox and Smarty?

I am having trouble with smarty…

How do I make this:

echo '<input name="event_electric" type="checkbox" id="event_electric" value="yes"';
		if($event['event_electric'] == 'yes')
print " checked=\\"checked\\" ";
echo '>';

into smarty…

I have tryid this:

echo $this->CreateInputCheckbox($id, 'event_electric',1, $event['event_electric']);

The smarty script do update the db, but when the field is “yes” I can not see that it is checked… Help!

Smarty as in the Template engine?

In your phpcode:


$smarty->assign("event_electric", $event['event_electric']);
$smarty->display("thetemplate.tpl");

In your smarty template:


<input name="event_electric" type="checkbox" id="event_electric" value="yes"' {if $event_electric == "yes"}checked="checked"{/if}>