Hi,

First of all you need to set User's relation with Email. From the DB schema
you provided, I think it should be User hasOne Email. The view should be
something like

echo $form->create('User');
echo $form->input('name');
echo $form->input('Email.email');
echo $form->end('Submit');

and the code in action method to save it will be like

$this->User->saveAll($this->data);

Hope this helps.

Amit Badkas

PHP Applications for E-Biz: http://www.sanisoft.com



On Tue, Nov 16, 2010 at 9:54 AM, Rey Philip <reyphilipre...@gmail.com>wrote:

> I a newbie question. This is how can I save data in many tables. Heres
> a scenario, example I have a Profiles controller, then I have a
> register method/action. Lets say I have 2 tables involved the users
> table and emails table, this is only for the sake of the
> demonstration. In my view in the register method there are two input
> boxes name which resides in the users table and email textbox for the
> emails table. Now what I want to do is that, when I press the submit
> button I want the name to be saved in the names table and the email to
> the emails table..
>
> Here is the schema:
>
> users table:
> id
> name
>
> emails table:
> id
> user_id
> email
>
> I wonder what the view for register method would look like, since the
> form->create() methods 1st paramter is the name of the model.. And
> also how do I saved the data on two different tables.
>
> Again, thanks in advance.
>
> Philip
>
> Check out the new CakePHP Questions site http://cakeqs.org and help others
> with their CakePHP related questions.
>
> 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+unsubscr...@googlegroups.com<cake-php%2bunsubscr...@googlegroups.com>For
>  more options, visit this group at
> http://groups.google.com/group/cake-php?hl=en
>

Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

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+unsubscr...@googlegroups.com For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en

Reply via email to