CFMAIL & CFINSERT output on 1 form???

New User fills out relevant info. on a FORM, "A.CFM"  Upon completion, hits the SUBMIT button.

I'm trying to send the contents of this form as an email, as well as to INSERT it into my database.

How would I get the form to process both the needs?  Kindly explain the syntax.... I would like the FORM ACTION of "A.CFM" to go to "B.CFM", which is a success notification page, once the data from the form has been emailed and inserted into the database, simultaneously.

Please respond ASAP!  Thanx!!

Ashish Rajput
asrajputAsked:
Who is Participating?
 
OeilNoirConnect With a Mentor Commented:
it's as simple as doing both individualy, to put the stuff in your
database, you can use CFINSERT, or make a query with the update statmenet in the b.cfm file, then use the cfmail to post it.

here is an exemple, i hope this will help you out

<!--- Content of a.cfm --->
<cfform method=POST name="application" action="b.cfm">
Email:
<cfinput type=text name="email" required="yes" size=25>
<br>
name:
<cfinput type=text name="name" required="yes" size=25>
<br>
login:
<cfinput type=text name="login" required="yes" size=25>
<br>
pass:
<cfinput type=password name="pass" required="yes" size=25>
<br>
<input type="submit" value="Send">
</cfform>
<!--- end of Content of a.cfm --->

<!--- Content of b.cfm --->
<CFINSERT DATASOURCE="#datasource#" TABLENAME="table" FORMFIELDS="field1, field2, field3">

<CFOUTPUT>
   <CFMAIL TO="email@domain.com" FROM="#form.email#"    SUBJECT="Message Subject">
<!--- Mail content --->    
     Here is the info you submitted
      name: #form.name#
      Login: #form.login#
      Pass: #form.pass#
   </CFMAIL>
</CFOUTPUT>
<!--- end of Content of b.cfm --->
0
 
OeilNoirCommented:
then you can put at the end of b.cfm the notification to user "Your form was processed correctly thanks bla bla bla"

if an error occrure before, that message will not apear
0
 
FRehmanCommented:
please tell us that you solve the problem or not if not then rejected and we will try to solve your problem
0
 
phillystyle123Commented:
20 pts for this one!  someone cashed in big!
0
All Courses

From novice to tech pro — start learning today.