tag:help.lighthouseapp.com,2008-09-20:/discussions/questions/1461-undefined-variable-formLighthouse: Discussion 2012-09-24T17:16:01Ztag:help.lighthouseapp.com,2008-09-20:Comment/189513932012-09-22T19:02:06Z2012-09-22T19:02:07ZUndefined variable: form<div><p>I have<br>
var $helpers = array('Html','Form'); in my Controller<br>
and method<br>
function add()</p>
<pre>
<code>{
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.');
}
}
}</code>
</pre>
<p>and i have file add.ctp which has code like this</p>
<p><?php<br>
echo $form->create('Task');?></p>
<pre>
<code><legend>Add New Task</legend>
<?php
echo $form->input('title');
echo $form->input('done');
?></code>
</pre>
<p><br>
<?php echo $form->end('Add Task'); ?></p>
<p>when i run add,it produces an error<br>
Undefined variable: form</p>
<p>Please Help, i am new to cake Thanks in advance.</p></div>Pawan Kumartag:help.lighthouseapp.com,2008-09-20:Comment/189513932012-09-24T14:52:57Z2012-09-24T14:52:57ZUndefined variable: form<div><p>Pawan -</p>
<p>This is the support forum for Lighthouse. You'll want to
resubmit your question to <a href=
"http://cakephp.lighthouseapp.com">http://cakephp.lighthouseapp.com</a>.
They will be able to help you.</p>
<p>Thanks,<br>
Nicole</p></div>Nicole