|
|
Server Time: Monday May 12 2008 07:07 AM |
|
Your Time: |
 |
Make a generic email form processor
This code will process any form submitted and email the submitted form fields excluding the submit, the redirect, the hidden, and the required fields; to the designated recipient.
This can be used for multiple web sites or multiple forms. The redirect is used to send the form user back to their own web site. I placed it in an accessible folder to all users, and gave them a Url to link to it if they wished to use the form. The redirect then had to contain a www.something.com to go back to their site. This makes it seamless.
For your own web site if you have multiple forms just refer the action to the place where you have the form processor. The url tag can then just have a page name you want them to go to after it is processed EX: index.html
Or The url tag is optional.
Create any html form.
Set the form action to go to your form processor file.
Make sure the form contains a required email field
Include 3 hidden fields:
recipient = who you want the email to go to
subject = the subject in the email you are sent
redirect = The page the form submitter is sent to after submission.
Ex:
<form action=”email_form.cfm”
method=”post”>
<input type= “hidden”
name=”recipient” value=”nyghtal@hotmail.com”>
<input type= “hidden”
name=”subject” value=
“Add to email list”>
<input type=”hidden”
name=”redirect”
value=”www.mypage.com”>
<input type=”hidden”
name=”email_required” value=”You must enter an email
address to submit this form”>
Name: <input type=”text”
name=”yourname” value=””><br>
Email Address: <input type=”text”
name=”email”
value=””><br>
<input type=”submit”
name=”submit”
value=”Add me to your email list”>
</form>
3Of course this does need pretty formatting
Make the email_form processor file.
The if statement is used to exclude the hidden, required ,redirect and submit fields. To not submit any empty fields add or #fields# is ""
to the if statement
<cfmail to="#form.recipient#"
from="#form.email#" subject="#form.subject#"
type=”html”>
#form.subject# <br><br>
<cfloop index="thefield"
list="#form.fieldnames#">
<cfset fields="#thefield# =
#evaluate(thefield)#">
<CFIF #fields# contains "submit" or #fields# contains
"required"
OR #FIELDS# contains "recipient" or #fields# contains
"subject"
or #FIELDS# contains
"redirect">
<cfelse>
#fields#<br>
</cfif>
</cfloop>
</cfmail>
<cflocation url="#form.redirect#"
addtoken="No">
Email Results:

Date added: Fri. December 13, 2002
Posted by: D Evans | Views: 17657 | Tested Platforms: CF5 | Difficulty: Intermediate
Mail
Checking for submitted form fields
This sets all of the submitted form fields and values into a list then loops through the list of fields and values. - Date added: Fri. December 13, 2002
Frameless Frames in CF
The appeal of frames and the continued use is -- to leave one constant item on a part of the page.
However clever, they are a pain to code, setting targets and defining the columns and then there that scroll bar thing. Here is an easy way to create the illusion of frames on your page.
- Date added: Wed. December 11, 2002
Dynamic Image Gallery
You will be shown how to display the images in the desired number of
columns and desired number of records per page with minimal coding. When the thumbnail image is clicked on it will open another window with the large image and image description under it. - Date added: Sun. December 8, 2002
|
|
|
|
|
|
|
|