Home N-13 News Forums Help Search
RegisterForgot password?
How to add image to post necklacesdiscou
Known bugs - 4.0.3 necklacesdiscou

Latest N-13 News 4.0.3

What is N-13 News?
Where can I get help?
Known bugs

Forums Tutorials Creating checkbox arrays with CakePHP
Chris
Posted on 23 Dec 2011, 04:03:34

Access: Admin
Total Posts: 1395
Joined: 2006-05-19

Useful tip for creating checkbox arrays using the form helper similar to

<input name="test[]" type="checkbox" />

If you add a dot to the end of the name when creating the checkbox, the formhelper will automatically turn it into an array, so the following

echo $this->Form->input("test.", array("type" => "checkbox"));

Will output

<input name="Model.test[]" type="checkbox" />
#3647
Last edited by Chris at 2011-12-23 04:08:30 Reason: .
Network-13.com © 2013