sasori Posted October 15, 2008 Share Posted October 15, 2008 am a noob and i need help in cake php.. i dont' know how to fix this error here's my codes //task.php <?php class Task extends AppModel{ var $name = 'Task'; } ?> //class TaskController <?php class TasksController extends AppController{ var $name = 'Tasks'; var $helpers = array('Html','FORM'); function index(){ $this->set('tasks',$this->Task->find('all')); } 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.');} } } } ?> //add.ctp <?php echo $form->create('Task');?> <fieldset> <legend>Add New Task</legend> <?php echo $form->input('title'); echo $form->input('done'); ?> </fieldset> <?php echo $form->end('Add Task');?> //index.ctp <h2>Tasks</h2> <?php if(empty($tasks)): ?> There are no tasks in this list <?php else: ?> <table> <tr> <th>Title</th> <th>Status</th> <th>Modified</th> <th>Actions</th> </tr> <?php foreach($tasks as $task): ?> <tr> <td> <?php echo $task['Task']['title'] ?> </td> <td> <?php if($task['Task']['done']) echo "Done"; else echo "Pending"; ?> </td> <td> <?php echo $task['Task']['created'] ?> </td> <td> <?php echo $task['Task']['modified'] ?> </td> <td> <!-- actions on tasks will be added later --> </td> </tr> <?php endforeach; ?> </table> <?php endif; ?> when i point browser to localhost/cooktoodoo/task/add that screenshot appears Quote Link to comment https://forums.phpfreaks.com/topic/128468-solved-cake-php-help/ Share on other sites More sharing options...
kazil Posted October 15, 2008 Share Posted October 15, 2008 I haven't used cakephp before, but try renaming the f_o_r_m.php file as the class name in it, which will be FORM in your case. Better yet, rename the class FormHelper and the filename Form.php. Hope that helps. Quote Link to comment https://forums.phpfreaks.com/topic/128468-solved-cake-php-help/#findComment-665929 Share on other sites More sharing options...
DarkWater Posted October 15, 2008 Share Posted October 15, 2008 I haven't used cakephp before, but try renaming the f_o_r_m.php file as the class name in it, which will be FORM in your case. Better yet, rename the class FormHelper and the filename Form.php. Hope that helps. No, that's not it. Use 'Form' in your $helpers array, not FORM. Quote Link to comment https://forums.phpfreaks.com/topic/128468-solved-cake-php-help/#findComment-666443 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.