the database. Its never getting to log "test2" I guess the data is
not in the right format but how am I supposed to do it? I've already
spent a considerable amount of time debugging this and other problems,
please help!
thanks.
CREATE TABLE users
(
id int NOT NULL AUTO_INCREMENT,
lastName varchar(255),
firstName varchar(255),
picture_id int,
about_me varchar(255),
PRIMARY KEY (id)
);
here's the model:
class User extends AppModel
{
// Its always good practice to include this variable.
var $name = 'User';
// This is used for validation, see Chapter "Data Validation".
var $validate = array();
}
controller:
class NewuserController extends AppController
{
var $name = 'Newuser';
var $uses = Array('User');
function index()
{
}
function add() {
$this->log('in newuser_controller add()');
if(!empty($this->data)) {
$this->log('test1');
//If the form data can be validated and saved...
if($this->User->save($this->data['User']['about_me'])) {
$this->log('test2');
//Set a session flash message and redirect.
$this->Session->setFlash("User Saved!");
$this->redirect('add');
}
}
}
}
View:
...
<form action="<?php echo $html->url('/newuser/add'); ?>"
method="post">
<? //echo $form->create('User'); ?>
<FONT CLASS="text12"> <BR>Describe yourself</FONT>
<?php echo $html->textarea('User/about_me')?>
<?php echo $html->submit('Add'); ?><br/>
<? //echo $form->end('Add User'); ?>
</form>
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
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?hl=en
-~----------~----~----~----~------~----~------~--~---
No comments:
Post a Comment