After the Event info has been submitted, if your models are set up
correctly, you should get the Event id included in your User form if
it's in $this->data['Event']['id']
User form:
$form->hidden('Event.id')
However, wouldn't it make more sense to submit the User info before
the Event info? I assume that a User hasMany Event. In which case,
you'd have the User submit their info and ensure that
$this->data['User']['id'] was set before rendering (not redirect to)
the Event form view, which would have:
echo $form->hidden('User.id');
>From your description, I'd think this would be a better way to handle it.
On Fri, Jan 16, 2009 at 9:12 PM, mike <[email protected]> wrote:
>
> I have a multi page input form thingy - on the first page, the user
> inputs some event information, then clicks next, this information is
> saved, then on the next page, the user inputs some user information,
> clicks save, and this information is saved. The issue is, now the
> event info has to be associated with the user info - i need to set the
> foriegn key to the user in the event table = to the user id just added
>
> so whats the best way to do this?
>
> does using getLastInsertId on the event work in the user controller?
> (doesn't seem like it)
>
> or am I supposed to pass the event id to the user controller through
> the url somehow and get it using params['pass'] or something?
>
> thanks
> >
>
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"CakePHP" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/cake-php?hl=en
-~----------~----~----~----~------~----~------~--~---