1

I am facing some problem of calling to a member function create() on a non-object

please help me out,My code is :-

  <?php
     echo $form->create('Register', array('action' => 'register'));
     echo $form->input('username');
     echo $form->input('password');
     echo $form->input('cnfrmpassword', array('type' => 'password'));
     echo $form->submit();
     echo $form->end();
  ?>
Vins
  • 8,849
  • 4
  • 33
  • 53
user786
  • 383
  • 1
  • 3
  • 15

1 Answers1

5

Try like this.... You're missing $this-> before the helper.

<?php
     echo $this->Form->create('User', array('action' => 'register'));
     echo $this->Form->input('username');
     echo $this->Form->input('password');
     echo $this->Form->input('cnfrmpassword', array('type' => 'password'));
     echo $this->Form->end('Submit');
?>
Ceeram
  • 748
  • 4
  • 9
Vins
  • 8,849
  • 4
  • 33
  • 53
  • but now when i call the **register()** it gives a error that call to a member function **save()** to a non-abject ` public function register() { if ($this->request->is('post')) { if ($this->Post->save($this->request->data)) { $this->Session->setFlash('Your post has been saved.'); $this->redirect(array('action' => 'reg')); } else { $this->Session->setFlash('Unable to add your post.'); } } } ?>` – user786 Aug 20 '12 at 09:54