check_box

Syntax:

$form_helper->check_box( $object_name,[ $column_name ],[ $options ],
    [ $checked_value ],[ $unchecked_value ])

Description:
Produces a checkbox tag tailored for accessing the attribute identified by $column_name on $object_name.
It's expected that $column_name will return an integer and if that integer is above zero, then the checkbox is checked.
Additional $options on the input tag are to be passed as an array.
The $checked_value defaults to 1 while the $unchecked_value defaults to 0. Usually unchecked checkboxes don't post anything. We work around this problem by adding a hidden value with the same name as the checkbox.
Example 1:

$form_helper->check_box("post", "validate");

If $Post->validate() returns 1, the HTML code generated is

<input type="checkbox" id="post_validate" name="post[validate]" value="1" checked="checked" /> 
<input name="post[validated]" type="hidden" value="0" />

Example 2:

$form_helper->check_box("puppy", "gooddog", array(), "yes", "no");

If $Puppy->gooddog() returns no, the HTML code generated is

<input type="checkbox" id="puppy_gooddog" name="puppy[gooddog]" value="yes" /> 
<input name="puppy[gooddog]" type="hidden" value="no" />

check_box_tag

Syntax:

$form_tag_helper->check_box_tag($name,[ $value ],[ $checked ],[ $options ])

Description:
Produces a checkbox tag. The default $value is '1'. The default $checked is false.