Undefined variable: form

Pawan Kumar's Avatar

Pawan Kumar

22 Sep, 2012 07:02 PM

I have
var $helpers = array('Html','Form'); in my Controller
and method
function add()

    if (!empty($this->data)) 
        if ($this->Task->save($this->data)) 
            $this->Session->setFlash('The Task has been saved');
            $this->redirect(array('action'=>'index'), null, true);
            $this->Session->setFlash('Task not saved. Try again.');

and i have file add.ctp which has code like this

echo $form->create('Task');?>

<legend>Add New Task</legend>
     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.

  1. 1 Posted by Nicole on 24 Sep, 2012 02:52 PM

    Nicole's Avatar

    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.


  2. Nicole closed this discussion on 24 Sep, 2012 02:52 PM.

Discussions are closed to public comments.
If you need help with Lighthouse please start a new discussion.

Keyboard shortcuts


? 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