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
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">
<cfinput type=text name="email" required="yes" size=25>
<cfinput type=text name="name" required="yes" size=25>
<cfinput type=text name="login" required="yes" size=25>
<cfinput type=password name="pass" required="yes" size=25>
<input type="submit" value="Send">
<!--- end of Content of a.cfm --->

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

   <CFMAIL TO="" FROM=""    SUBJECT="Message Subject">
<!--- Mail content --->    
     Here is the info you submitted
      Login: #form.login#
      Pass: #form.pass#
<!--- end of Content of b.cfm --->
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
please tell us that you solve the problem or not if not then rejected and we will try to solve your problem
20 pts for this one!  someone cashed in big!
All Courses

From novice to tech pro — start learning today.