HostIssues Community Forums  
Go Back   HostIssues Community Forums > Hosting, Design & Development > Design & Development > Scripts & Tutorials

Notices

Scripts & Tutorials The official AeonCube products and other scripts, code snippets and tutorials.

Reply
 
Thread Tools
  #1  
Old October 28th, 2007, 08:07 PM
j-lucas j-lucas is offline
AeonCube Administrator
 
Join Date: Aug 2006
Location: United Kingdom
Posts: 1,364
ColdFusion Creating a simple contact form

Creating a simple contact form | Level: Easy | ColdFusion 7 (Tested)

Step 1 | The IF Statements
Quote:
<cfif IsDefined("form.Subject")>
</cfif>
The IF statements what until the form has been posted to then process the forms operations

Step 2 | The Form
Quote:
<cfform action="#CGI.SCRIPT_NAME#" method="post">
email <cfinput type="text" name="From" size="20"><br />
Subject <cfinput type="text" name="Subject" size="20"><br />
Message <textarea name="Message" cols="30" rows="3" ></textarea><br />
<input type="submit" value="Submit it" />
</cfform>
This is a standard sort of email form apart from the 'form' tags, you will notice they have 'cf' in front of the 'form' this tag now allows you to add more options to the form. These will be explained in another tutorial.

Step 3 | Processing the form
Quote:
<cfprocessingdirective suppresswhitespace="no">

<cfmail subject="#form.Subject#" from="#form.From#" to="EMAIL@EMAIL.COM" >
This is a message from that form...
#form.Message#
</cfmail>

</cfprocessingdirective>
The above the code processes the email form and send the email to who ever is listed in the 'to' and you can add 'cc' or 'bcc'

Full code
Quote:
<cfif IsDefined("form.Subject")>

<cfprocessingdirective suppresswhitespace="no">

<cfmail subject="#form.Subject#" from="#form.From#" to="EMAIL@EMAIL.COM" >
This is a message from that form...
#form.Message#
</cfmail>

</cfprocessingdirective>

<cfelse>

<cfform action="#CGI.SCRIPT_NAME#" method="post">
email <cfinput type="text" name="From" size="20"><br />
Subject <cfinput type="text" name="Subject" size="20"><br />
Message <textarea name="Message" cols="30" rows="3" ></textarea><br />
<input type="submit" value="Submit it" />
</cfform>

</cfif>
You can copy the full code into your coldfusion page which can be coldfusion 6+ including the new coldfusion 8 released by adobe. More advanced contact forms will be posted here later on.

Enjoy!
Attached Files
File Type: zip aeoncube_contact_form.zip (2.4 KB, 54 views)
__________________
HostMediaUK : Low Cost Hosting | Linux PHP Hosting | Windows ColdFusion Hosting | ASP Hosting | Reseller Hosting | Dedicated Servers
AeonCube Networks : Web Design, ColdFusion Development and Web Hosting
Reply With Quote
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off


All times are GMT. The time now is 06:10 AM.


Powered by vBulletin® Version 3.7.4
Copyright ©2000 - 2010, Jelsoft Enterprises Ltd.
© 2001-2009 AeonCube Networks A Registered UK Trading Company Skin design and concept by Attitude