使用cakephp在数据库中提交表单数据


submit form data in database using cakephp

我正在使用cakepp,我想在数据库中插入表单数据,但我收到了以下错误:

在数据源默认值中找不到模型Post的表posts。

如何将数据保存到数据库中。在cakepp中,我们如何将数据从控制器发送到模型?

// this is my view code 
echo $this->Form->create('posts', array('action' => 'Add'));
echo $this->Form->input('title', array('label' => 'Enter your email address:'));
echo $this->Form->end('Add');

// this is my controller code
public function Add() {
    $this->request->data['posts']['title'] = $this->request->data["posts"]["title"]; 
    $this->Post->save($this->request->data);
}

Error表示没有创建模型"Post"。您需要创建PostsTable.php文件,并将其放在src/Model/Table文件夹中。

也可以试试CakeBook中的CakePHP教程。