Form processor with individual link email
<--- NEW FILE: this is the form processor that gets info from an HTML form I call it ProcessNewEntry.cfm--->

<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>



All ColdFusion Tutorials By Author: Rhino
  • Auto Event Emailer
    Queries the database everyday and sends an email automatically when certain events happen.
    Author: Rhino
    Views: 16,119
    Posted Date: Friday, December 13, 2002
  • Column View Output
    Ever wanted your data to be output in a column view such as mailing labels are? Use this code and change only a few lines and your data will be output in a table with 3 columns and as many rows as you have data. A great alternative to the standard row based view. Very easy to modify.
    Author: Rhino
    Views: 8,434
    Posted Date: Wednesday, February 25, 2004
  • Count Down
    Easy CFM file that counts down from a distant date to the present. Can show how many days, months, or years.
    Author: Rhino
    Views: 13,290
    Posted Date: Friday, December 13, 2002
  • Enter-Update same form
    I hate creating duplicate forms where one is for entry and an identical one is for udpating. This code lets you use one form for both purposes.
    Author: Rhino
    Views: 10,582
    Posted Date: Wednesday, April 7, 2004
  • Form processor with individual link email
    This tutorial shows how to process a form and generate a random string that is put on the end of a link. When the user clicks the link it goes to their personal page.
    Author: Rhino
    Views: 10,754
    Posted Date: Wednesday, March 31, 2004
  • Form with 2 Submit Buttons
    An easy way to have a form with 2 or more submit buttons where each one does a different thing. One can count a rows in a DB, then next can actually submit the query. Possibilities are limitless.
    Author: Rhino
    Views: 15,093
    Posted Date: Monday, October 9, 2006
  • IP checker
    Checks to see where the user came from and then decides where to send them.
    Author: Rhino
    Views: 14,103
    Posted Date: Friday, December 13, 2002
  • Use checkboxes on update pages
    Do you have an update page and want to use checkboxes on the page? This tutorial will go over the two steps needed.
    Author: Rhino
    Views: 10,193
    Posted Date: Wednesday, March 31, 2004
  • User Authenication - ADMIN area
    This script provides a simple admin area for the login script written by Pablon on this site. You can list, add, change pass, and delete users.
    Author: Rhino
    Views: 12,712
    Posted Date: Monday, March 29, 2004
  • Website Monitor
    Do you have a website that you'd like to monitor but would rather not pay outrageous fees to some company? This simple script will monitor uptime for you website. It is the barebones version and can be easily modified into something highly useful.
    Author: Rhino
    Views: 12,947
    Posted Date: Wednesday, March 24, 2004