Here you go;
This assumes a database table named "yourtable" with 2 fields: sender,
message.
It's simple, but should get you started.
--Dylan
<!----- cut and paste this code into a file called
email_from_form.cfm ----->
<CFIF #IsDefined("submit_form")#>
<!----- insert data into my database table ----->
<CFQUERY DATASOURCE="your_DSN">
INSERT INTO
yourtable
(
sender,
message
)
VALUES
(
'#form.sender#',
'#form.message#'
)
</CFQUERY>
<!----- email the form information to [EMAIL PROTECTED] ----->
<CFMAIL
TO="[EMAIL PROTECTED]"
FROM="Your email app <[EMAIL PROTECTED]>"
SUBJECT="Email from my form">
This is an email from #form.sender#:
#form.message#
</CFMAIL>
</CFIF>
<FORM ACTION="email_from_form.cfm" METHOD="POST">
Sender:
<BR>
<INPUT TYPE="TEXT" NAME="sender" SIZE="40">
<BR><BR>
Message:
<BR>
<TEXTAREA NAME="message" ROWS="8" COLS="50" WRAP="VIRTUAL"></TEXTAREA>
<BR><BR>
<INPUT TYPE="SUBMIT" NAME="submit_form" VALUE="Submit & email this form">
</FORM>
<!----- end code ----->
-----Original Message-----
From: Jones, Becky [mailto:[EMAIL PROTECTED]]
Sent: Monday, March 05, 2001 9:04 AM
To: CF-Talk
Subject: email
is there a way to have a form that when a user types in data, it gets
submitted to a database and an email of the data goes to a specific person
or persons?
thanks,
bec.
*************************************************
This e-mail, including any attachments, is intended for the
receipt and use by the intended addressee(s), and may contain
confidential and privileged information. If you are not an intended
recipient of this e-mail, you are hereby notified that any unauthorized
use or distribution of this e-mail is strictly prohibited.
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Structure your ColdFusion code with Fusebox. Get the official book at
http://www.fusionauthority.com/bkinfo.cfm
Archives: http://www.mail-archive.com/[email protected]/
Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists