我可以't插入数据到数据库的形式使用CakePHP2.4


I can't insert data in to database by form using CakePHP2.4

我是CakePHP的新手,刚刚创建了我的东西。

我不能添加数据到数据库从表单使用CakePHP2,4。我的控制器页面是StaffsController.php.View页面在view->Staff->add。我的模型页面是Staff.php.table name - staff id int pk title var char(200).

//My Code.

class StaffsController extends AppController 
{
    function index()
    {
    $this->set('posts', $this->Staff->find('all')); 
    }
    public function add() {
        if ($this->request->is('post')) {
            $this->Staff->create();
            $post_data = $this->request->data;
            if ($this->Staff->save($post_data)) {
                $this->Session->setFlash(__('New post saved successfully to the database'));
                return $this->redirect(array('action' => 'index'));
            }
            $this->Session->setFlash(__('Unable to save the post to the database.'));
        }
}
}

// add.ctp
 <h1>Add Post</h1>
<?php
echo $this->Form->create('Post');
echo $this->Form->input('title');
echo $this->Form->end('Save');
?>
//My Model Page 
<? php
class Staff extends AppModel
 {
 }
?>

检查

<?php
echo $this->Form->create('Staff');
echo $this->Form->input('title');
echo $this->Form->end('Save');
dont use create('post');