Thursday, February 17, 2011

how to automatically have the logged in users id in a form

Hi there, I've searched through a bunch of tutorials but no-one seems
to explain this particular situation. I have a model for users and a
model for what I call campaigns, which a logged in user is allowed to
create. So I've got Auth up and running and the relationship set up so
a campaign belongs to a user.

So the user logs in and is directed to the create campaign action. In
the form that the user fills in, I want the users_id to be the id of
the currently logged in user by default.

echo $this->Form->input('user_id');

I know this is probably dead simple, but all the tutorials I've been
through don't tell me. The blog tutorial(s) there is only one possible
user; in the TOR tutorial its a drop down list to select which dealer
etc... etc...

--
Our newest site for the community: CakePHP Video Tutorials http://tv.cakephp.org
Check out the new CakePHP Questions site http://ask.cakephp.org and help others with their CakePHP related questions.


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

0 Comments:

Post a Comment

Subscribe to Post Comments [Atom]

<< Home


Real Estate