I set some defaults in case the parameters don't come in correctly
<cfparam name="payer_email" default="john@doe.com">
<cfparam name="txn_id" default="999999">
<cfparam name="first_name" default="firstname">
<cfparam name="last_name" default="lastname">
<cfparam name="mc_gross" default="0.00">
<cfparam name="address_city" default="novalue">
<cfparam name="address_state" default="novalue">
<cfparam name="address_zip" default="novalue">
<cfparam name="key" default="novalue">
<cfparam name="item_name1" default="novalue">
<cfparam name="item_number1" default="novalue">
<cfparam name="quantity1" default="novalue">
<cfparam name="mc_gross_1" default="mc_gross_1">
Based on our own configuration, we only really sell one product
<cfparam name="item_name2" default="novalue">
<cfparam name="item_number2" default="novalue">
<cfparam name="quantity2" default="novalue">
<cfparam name="mc_gross_2" default="mc_gross_2">
The parameters some in via a form
<cfset email='#Form.payer_email#'>
<cfset txn_id='#Form.txn_id#'>
<cfset first='#Form.first_name#'>
<cfset last='#Form.last_name#'>
<cfset mc_gross='#Form.mc_gross#'>
<cfset address_city='#Form.address_city#'>
<cfset address_state='#Form.address_state#'>
<cfset address_zip='#Form.address_zip#'>
<cfset key='#key#'>
<cfset item_name1='#Form.item_name1#'>
<cfset item_number1='#Form.item_number1#'>
<cfset quantity1='#Form.quantity1#'>
<cfset mc_gross_1='#Form.mc_gross_1#'>
<!-- only if it exists? -->
<CFIF IsDefined("FORM.quantity2")>
<cfset item_name2='#Form.item_name2#'>
<cfset item_number2='#Form.item_number2#'>
<cfset quantity2='#Form.quantity2#'>
<cfset mc_gross_2='#Form.mc_gross_2#'>
</CFIF>
<!-- Serial Numbers (Product Keys) are published with a Carraige Return/Line Feed, for simplicity I replace that with a "+" sign so I can stick them into one database field -->
<cfset key = Replace(key, Chr(13), "+", "ALL")>
<cfset key = Replace(key, Chr(10), "+", "ALL")>
Here is the real code
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "
http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="
http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>eJunkie Processing</title>
</head>
<body>
<!-- Here I'm creating an email as a backup mechanism -->
<CFMAIL TO="me@mydomain.com"
SERVER="mail.mydomain.com"
FROM="ejunkie@mydomain.com"
SUBJECT="eJunkie Purchase from #email#">
User Information
email: #payer_email#
txn_id: #txn_id#
First: #first#
Last: #last#
Payment: #mc_gross#
address_city=#address_city#
address_state=#address_state#
address_zip=#address_zip#
Serial Number
serialnumber=#key#
Item 1
item_name1=#item_name1#
item_number1=#item_number1#
quantity1=#quantity1#
mc_gross_1=#mc_gross_2#
Item 2
item_name2=#item_name2#
item_number2=#item_number2#
quantity2=#quantity2#
mc_gross_2=#mc_gross_2#
</CFMAIL>
<!-- now do the SQL Insert Statement -->
<cfquery name="qeJunkieInsert" datasource="mydatabase">
Insert into eJunkie (transactdate, txn_id, email, firstname, lastname, grossamount, city, state, zip, serialnumber)
values
(#CreateODBCDate(now())#, '#txn_id#', '#payer_email#', '#first#', '#last#', #mc_gross#, '#address_city#', '#address_state#', '#address_zip#', '#key#')
</cfquery>
Thanks
</body>
</html>
And that's it. Works for me, pretty simple.