Undefined variable: form
I have
var $helpers = array('Html','Form'); in my Controller
and method
function add()
{
if (!empty($this->data))
{
$this->Task->create();
if ($this->Task->save($this->data))
{
$this->Session->setFlash('The Task has been saved');
$this->redirect(array('action'=>'index'), null, true);
}
else
{
$this->Session->setFlash('Task not saved. Try again.');
}
}
}
and i have file add.ctp which has code like this
<?php
echo $form->create('Task');?>
<legend>Add New Task</legend>
<?php
echo $form->input('title');
echo $form->input('done');
?>
<?php echo $form->end('Add Task'); ?>
when i run add,it produces an error
Undefined variable: form
Please Help, i am new to cake Thanks in advance.
Discussions are closed to public comments.
If you need help with Lighthouse please
start a new discussion.
Keyboard shortcuts
Generic
| ? | Show this help |
|---|---|
| ESC | Blurs the current field |
Comment Form
| r | Focus the comment reply box |
|---|---|
| ^ + ↩ | Submit the comment |
You can use Command ⌘ instead of Control ^ on Mac
1 Posted by Nicole on 24 Sep, 2012 02:52 PM
Pawan -
This is the support forum for Lighthouse. You'll want to resubmit your question to http://cakephp.lighthouseapp.com. They will be able to help you.
Thanks,
Nicole
Nicole closed this discussion on 24 Sep, 2012 02:52 PM.