Aug 26, 2015

CakePHP 2 - Forms

When you try to create a new form in CakePHP framework using FormHelper, you may have this error:

Missing Database  Table
And if you read very carefully  the Book of CakePHP will see something like that:

You can also pass false for $model. This will place your form data into the array: $this->request->data (instead of in the sub-array: $this->request->data['Model']). This can be handy for short forms that may not represent anything in your database.
So, in your view file like APP/View/Contact/index.ctp, you have  to start with this line:

echo $this->Form->create(false, array('url' => '/contact'));

Good luck!

No comments:

Post a Comment