here is the controller dump:
[data] => Array
(
[UsersEthnicity] => Array
(
[ethnicity_id] => Array
(
[0] => 1
[1] => 2
)
[users_id] => 14
)
[User] => Array
(
[age] => 21
[about_me] => adfsadfs
)
)
but I need something like this right?
[data] => Array
(
[UsersEthnicity] => Array
(
[ethnicity_id] => 1
[users_id] => 14,
[ethnicity_id] => 2
[users_id] => 14
)
[User] => Array
(
[age] => 21
[about_me] => adfsadfs
)
)
here's the controller function:
function add() {
$this->log('in newuser_controller add()');
$this->User->create();
if(!empty($this->data)) {
$this->log($this->data);
$this->log('test1');
//If the form data can be validated and
saved...
if($this->User->save($this->data)) {
$this->data['UsersEthnicity']['users_id'] =
$this->User->id;
$this->UsersEthnicity->save($this->data);
$this->log('test2');
//Set a session flash message and redirect.
$this->Session->setFlash("User
Saved!");
//$this->redirect('newuser/add');
}
}
}
view:
<? echo $form->input('UsersEthnicity.ethnicity_id', array( 'type' =>
'select', 'multiple' => 'checkbox' ),$ethnicities); ?>
--~--~---------~--~----~------------~-------~--~----~
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