Hi, I'm trying to get the remote user name of the user and put it into my SQL query. My code is below but I'm not sure how to get my desired result. If you need some more infomation please let me know. Thanks in advance. Mark (Minty). <!--- Name: submit2.cfm Author: Mark Oldham Description: Confirmation page, data submission and email process. Modifications: 15/01/2007 : 08.07 : created base file. 16/01/2007 : 11.48 : Email process enabled. 17/01/2007 : 13.48 : Reference Number added to emails. ---> <!--- Code to insert the form data into the requests01 table in the database. ---> < CFINSERT DATASOURCE="revolution" TABLENAME="requests01" > <!--- Query to select the last record in the table requests01. ---> <cfquery datasource="revolution" name="ccrefget"> SELECT TOP 1 * FROM requests01 ORDER BY ccref DESC </cfquery> <!--- Query to select the email address of the current user from the users table. ---> <cfquery datasource="revolution" name="getemail"> SELECT email FROM users WHERE username='#CGI.REMOTE_USER#' </cfquery> <!--- <cfinclude template="mail.cfm"> ---> <!--- Email confirmation process ---> <cfmail server="164.38.196.141" from="noreply.revolution@dsgibusiness.com" to="authteam.revolution@dsgibusiness.com" cc="<cfoutput>#getemail.email#</cfoutput>" subject="New Change Request - CCREF: #ccrefget.CCREF# " > Change Control Reference: <cfoutput> #ccrefget.CCREF# </cfoutput> A new change request has been submitted by #CGI.REMOTE_USER#. If you have been asked to approve the request please use the link below and select Approve Request. http://revolution/ Revolution Change Control System @ DSGi Business </cfmail> <!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>Change Request Subbmission Complete</title> <style type="text/css"> <!-- .style1 {color: #000066} .style2 {color: #FF0000} .style3 {color: #000000; } --> </style> </head> <body> <h1 align="center" class="style1"><img src="../images/dsgilogo.gif" width="118" height="49" /></h1> <h1 align="center" class="style1">Revolution </h1> <h3 align="center" class="style2">Submission Complete</h3> <p align="center" class="style3"> </p> <p align="center" class="style3">Your change re request has been submitted and you Reference Number is: <cfoutput> #ccrefget.CCREF# </cfoutput> </p> <p align="center" class="style3"> </p> <p align="center" class="style3">You will shortly recieve an email with details of your request including the change control reference number for you records. </p> <p align="center" class="style2"> </p> </body> <meta http-equiv="refresh" content="8;URL=../home.cfm" /> </html>
Hello Minty - provide some more information - what are you trying to do? You may want to use sessions to store user information. Be as detailed as possible
I have a database and one of the tables is called users and there is a list of users and it also has thier email address in the. When the submit a for I then want the cfmail to send an email to the username email address. So I thought if I create a query to select the email address from the table using the remote username. Then I was hoping to insert it into the cfmail using a cfoutput. Query: <cfquery datasource="revolution" name="getemail"> SELECT email FROM users WHERE username='#CGI.REMOTE_USER#' </cfquery> cfmail: <cfmail server="x.x.x.x" from="noreply.revolution@domain.com" to="authteam.revolution@domain.com" cc="<cfoutput>#getemail.email#</cfoutput>" subject="New Change Request - CCREF: #ccrefget.CCREF# " > Change Control Reference: <cfoutput> #ccrefget.CCREF# </cfoutput> A new change request has been submitted by #CGI.REMOTE_USER#. If you have been asked to approve the request please use the link below and select Approve Request. Revolution Change Control System @ DSGi Business </cfmail>
take out the <cfoutput> tags. That is change: cc="<cfoutput>#getemail.email#</cfoutput>" to: cc="#getemail.email#"
As a general rule, you don't need <CFOUTPUT> when you are inside a CF tag. In this case, cfmail is already looking for #variables#. Also, be aware that pound signs are not always necessary.