Hello everyone, I'm trying to send email with the link that includes user id. After users click on the link they should be able to see the form with their information that has been previously filled. So my question is after I send the email how and what is the best way to pull information and show them to user. Should that be separate page with the cfquery limited on user id or something else? If anyone has any idea what is the best way to do this please let me know. I already have my code that send emails.
What is the format of the user id? Is it a number? If so, you could use the ColdFusion Hashids CFC to salt+generate a unique ID to use in a URL:
You could then attempt to parse the hashIds back into a number and, if possible, allow them to edit the associated record that matches the ID.
Another option would be to generate a random hash and store it in database w/information regarding the update form and user id. After the link is clicked, log the date so that the link is disabled and can't be used again.
The return page should use SSL and potentially require them to log in (depending upon the sensitivity of the data that will be updated.)
What is the best way to retrieve information after user click on the link? First step will be to decrypt the ID(yes it is a number) and then pull the information with cfquery or ? I'm trying to think what is the best and most efficient way of doing this. Thank you for help.
I'm not sure I understand your question. What do you mean by the "best and most efficient way"? What are you specifically requesting assistance on? (Your question is somewhat vague.)
I already have a form where user enter all information and after they click submit they receive the link. If they click on the link I want to use the same form and populate all fields with user info.
Are you saving all of the initially submitted fields to a database? If so, perform a query and then output the query values to the form field. I don't know what your data (or database) looks like, but a simplified version could look something like this.
<CFQUERY NAME="GetForm" DATASOURCE="MyDB">SELECT FirstName
WHERE ID = <cfqueryparam value="#URL.ID#" cfsqltype="CF_SQL_INTEGER"></CFQUERY>
<input type="text" name="FirstName" value="#HTMLEditFormat(FirstName)#">