i'm try to add a new row to a table of my database by using CakePhp framework, but something it's not work properly. This is my add.ctp
echo $this->Form->create(array('type' => 'get'));
echo $this->Form->input('username');
echo $this->Form->input('password');
echo $this->Form->end('Save');
This is controller add function:
public function add() {
if ($this->request->is('get')) {
$this->Admin->create();
if ($this->Admin->save($this->request->data)) {
debug("done");
$this->Session->setFlash(__('Your post has been saved.'));
return $this->redirect(array('action' => 'index'));
}
}
}
and this is my Admin Model class:
class Admin extends AppModel {
public $validate = array(
'username' => array(
'rule' => 'notEmpty'
),
'password' => array(
'rule' => 'notEmpty'
)
);
but new row is never added to my Admins table. Database works fine (i can retrieve all rows inside table). I'm working on localhost with xampp