I am using coldfusion mx and mysql. I would like to have my users after they
login be able to click a link for "Update your Bio" and it takes that logged in
user to a form that allows them to update their personal information thats
already on the mysql table. I wasnt sure if I need to use a session variable OR
what would be the best approach.
ANY assistance is GREATLY appreciated.
Mark
Assuming you have uniquely identified the user, retrieve his profile from the
database. Display the profile form and populate those form elements where
there is data available from the database. Explain to the user he can change
information, delete information or add new information in the form. Be sure to
indicate which fields are manditory. When the user clicks the "Update Profile"
button, the action page should perform a SQL update with the unique user id in
the WHERE clause. No session variable is necessary, as you can pass the unique
user id as a hidden field.
Mark6372 - 27 Nov 2006 19:03 GMT
jdeline,
Thanks for the reply. How will the users browser know what his id is when
he clicks the "Update profile" button. What variable will be holding his logged
in information that will know what record to update in the action page?
Ian Skinner - 27 Nov 2006 20:31 GMT
You can use an <input type="hidden" name="someName"
value="#someIdValue#"> to make the user ID part of the form. It is then
submitted with the rest of the form data to the action page and utilized
the same as any of the other datum provided with the form.
Mark6372 - 27 Nov 2006 21:10 GMT
Well this will not actually take them to the action page yet. When they login
on there homepage is an option to update there information. Then when executed
takes them to an action page but only for their information.
Ian Skinner - 27 Nov 2006 21:35 GMT
When they login on there homepage is an option to update there
information. Then when executed takes them to an action page but only
for their information.
And I presume that this edit action page will have a form and that form
will submit to another action page to process it.
Mark6372 - 27 Nov 2006 22:03 GMT
Correct, but only see a session variable holding the users id when needed during the session. UNLESS there is an easier way.