so, I was finaly able to do it like this:
events controller, after save:
$event_id = $this->Event->getLastInsertId();
$this->Session->write('Event.id', $event_id);
users view:
$event_id = $session->read('Event.id');
echo $form->input('Event.id',array('type' => 'hidden', 'value' =>
$event_id ));
users controller:
$user_id = $this->User->getLastInsertId();
$this->User->Event->save($this->data);
$this->data['Event']['creator_id'] = $user_id;
maybe not the best way but at least it's working for now!
On Jan 16, 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
-~----------~----~----~----~------~----~------~--~---