Monday, September 26, 2011

Data Not Saving Saving to db

Hi,

I'm new to cake and have only have a fundamental understanding of
php. I've been watching video and practicing here and I have a issue
I am running into.

in the code below, everything seems to excite correctly except the
function is not adding the text from my entries in the form to the
db. it creates a new records and time stamps it fine. But no data.
Please help.

*posts_controller.php*

function add() {
if(!empty($this->data)) {
if($this->Post->save($this->data)) {
$this->Session->setFlash('Your post has been saved!');
$this->redirect(array('action'=>'index'));
} else {
$this->Session->setFlash('Your post was not saved. Please try
again.');
}
}

}

*add.ctp*

<h2>Add A Post</h2>
<?php
echo $form->create('Post', array('action'=>'add'));
echo $form->input('Title');
echo $form->input('Body');
echo $form->end('Create A Post');
?>

Thanks in advance,

(b)

--
Our newest site for the community: CakePHP Video Tutorials http://tv.cakephp.org
Check out the new CakePHP Questions site http://ask.cakephp.org and help others with their CakePHP related questions.


To unsubscribe from this group, send email to
cake-php+unsubscribe@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php

0 Comments:

Post a Comment

Subscribe to Post Comments [Atom]

<< Home


Real Estate