cakephp label in checkbox

Matteo picture Matteo · May 3, 2011 · Viewed 17.4k times · Source

i'm trying to get a checkbox with his label

echo $this->Form->checkbox('straordinari', array('div'=>'true', 'label' => 'Straordinari'));

in browser i get

<input id="ReportStraordinari_" type="hidden" value="0" name="data[Report][straordinari]">
<input id="ReportStraordinari" type="checkbox" value="1" label="Straordinari" div="true" name="data[Report][straordinari]">

but there is no label

where is the problem?

Answer

Chuck Burgess picture Chuck Burgess · May 3, 2011

You should get what you are looking for with the following:

echo $this->Form->input('straordinari', array('type' => 'checkbox'));