Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations MikeeOK on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

CFMAIL problem 1

Status
Not open for further replies.

farscp1

Programmer
Sep 18, 2005
33
US
My form action page displays what a users has submitted and then sends that same information to their email address.

Currently the <cfmail> information looks like:

Code:
    <table border="0" cellpadding="5" cellspacing="0">
	
	<CFSET variables.bg_color = "E5DEEB">
	
	<CFLOOP index="i" list="#form.fieldnames#">
	
		<CFIF variables.bg_color IS "E5DEEB">
			<CFSET variables.bg_color = "BBA8CB">
		<CFELSE>
			<CFSET variables.bg_color = "E5DEEB">
		</CFIF>
	    
		<tr>
		    <td bgcolor="#variables.bg_color#">#i#</td>
		    <td bgcolor="#variables.bg_color#">#evaluate(i)#</td>
	      </tr>
      </CFLOOP>
  </table>

Rather than send the course_id's I want to send the course name and date so I did a cfquery for those values and the used cfoutput but I get the following error message:

A query driven CFOUTPUT tag is nested inside a CFOUTPUT tag that also has a QUERY= attribute. This is not allowed. Nesting these tags implies that you want to use grouped processing.


The course information is course_id, course_name, course_date.

Thanks for your help.
 
If I understand you correctly, just change your CFOUTPUT tag to CFLOOP.

Otherwise, can you post the code that you are getting the error with?

Hope this helps

Wullie

Fresh Look - Quality Coldfusion/Windows Hosting

The pessimist complains about the wind. The optimist expects it to change. The leader adjusts the sails. - John Maxwell
 
Here is the complete code for the cfmail:

Code:
<cfmail.....>
<cfquery name="getReg" datasource="seligins">
	SELECT b.firstname, b.lastname, a.course_date, a.course_name
	FROM tblCourse a, tblAttendee b, tblRegistration_details d
	WHERE a.course_id = d.course_id
	AND d.h_email = '#Form.h_email#'
	AND b.h_email = '#Form.h_email#'
</cfquery>

	<!-- Get attendee information -->
	<cfquery name="getAttendee" datasource="seligins">
		SELECT *
		FROM tblAttendee
		WHERE h_email = '#Form.h_email#' 
	</cfquery>
	
	<p>
	<cfoutput query="getAttendee">
		<h3>
			#firstname# #lastname#, here are your registration details:<br>
		</h3>
	</cfoutput>
	
	<cfoutput query="getReg">
		<p>
		   <strong>#course_date#</strong>: #course_name#</br>
		</p>	
	</cfoutput>

</cfmail>
[/cfcode]

The is the same code I use to display a summary of the courses they've registered for. The sequence is display summary then send the email message.

Thanks for your reply.
 
It works! Awesome, can you give me a little information on why cfloop as opposed to cfoutput. Thanks again for your help.
:)
 
Coldfusion autmatically parses any variables inside the CFMAIL tag, so you don't need to use CFOUTPUT. CFLOOP on the other hand just loops, it doesn't tell CF to process the output for variables.

Hope this helps

Wullie

Fresh Look - Quality Coldfusion/Windows Hosting

The pessimist complains about the wind. The optimist expects it to change. The leader adjusts the sails. - John Maxwell
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top