<CFSET rlink = "">
<CFLOOP INDEX="R8ix" FROM="1" TO="24">
<CFSET rlink = rlink&Mid('abcdefghijklmnopqrstuvwxyz123456789',RandRange('1','35'),'1')>
</CFLOOP>
<---First a random string is created and assigned to the variable rlink--->
<---I use at least 24 characters in the string so there is minimal chance of duplicates --->
<---You could build in a query to make sure there are no duplicates, but with 24 random characters what are the chances really --->
<cfquery name="[queryname]" datasource="[dsn]">
INSERT INTO ajetdb (link)
VALUES
('#rlink#')
</cfquery>
<---Then the form variables are inserted into the db [they've been removed here] and the link is inserted as well --->
<CFIF email is "">
<CFLOCATION URL="somepage.htm">
<---If no email was provided then skip this part --->
<CFELSE>
<---If email was provided then email them a welcome letter with a link to their own info --->
<CFMAIL
to="#email#" From="Valid-From-Address <email@domain.com>"
Subject="Update">
Your letter here.
<---Simply add the link variable to the end of the link --->
http://www.somelink.com/update-details.cfm?link=#rlink#
<cfmailparam name = "Reply-To" value = "email@domain.com">
</cfmail>
<CFLOCATION URL="somepage.htm">
<!--- Once it's over you are redirected somewhere--->
</CFIF>
<--- NEW FILE: This is the page from the link above so here it is called update-details.cfm--->
<--- It's waiting for the URL with the LINK at the end--->
<CFQUERY
name="[queryname]"
datasource="[dsn]">
Select * from [tablename] where link='#link#'
</cfquery>
<---The URL has ?link= on it so this page is looking for that link and will pull up the info based on it --->
<html>
<head>
<title></title>
</head>
<body>
<p align="center"><b><font size="4">Please update your information:</font></b></p>
<CFOUTPUT query="[queryname]">
<form method="POST" action="processupdate.cfm?id=#id#">
<center>
<table border="0" cellpadding="0" cellspacing="0" style="border-collapse: collapse" width="45%" id="AutoNumber2">
<--- The HTML form will be populated with the person's individual info --->
<--- This is done by making the value of the textbox a CFOUTPUT variable--->
<tr>
<td width="50%" colspan="2"><b>First Name:</b></td>
<td width="50%">
<input name="firstname" value="#firstname#" size="20" style="float: right" tabindex="1"></td>
</tr>
<tr>
<td width="50%" colspan="2"><b>Last Name:</b></td>
<td width="50%">
<input name="lastname" size="20" style="float: right" value="#lastname#" tabindex="2"></td>
</tr>
<tr>
<td width="50%" colspan="2"><b>Gender:</b></td>
<td width="50%">
<input name="gender" size="20" style="float: right" value="#gender#" tabindex="3"></td>
</tr>
<tr>
<td width="50%" colspan="2"><b>Partner Name:</b></td>
<td width="50%">
<input name="partnername" size="20" style="float: right" value="#partnername#" tabindex="4"></td>
</tr>
<tr>
<td width="50%" colspan="2"><b>Email:</b></td>
<td width="50%">
<input name="email" size="20" style="float: right" value="#email#" tabindex="5"></td>
</tr>
</cfoutput>
</table>
</center>
<p align="center"><input type="submit" value="Submit" name="B1"><input type="reset" value="Reset" name="B2"></p>
</form>
</body>
</html>