Skip to main content
Known Participant
December 8, 2009
Question

Sending a form to email

  • December 8, 2009
  • 1 reply
  • 1651 views

I'm trying to make my contact form so that I can send it to my email address. I have 2 pages made, contact.cfm and contactreceived.cfm. Here is what I have for contact.cfm:

<cfinclude template="header2.cfm">     

<CFFORM METHOD="POST" action="contactreceived.cfm">                                     

<div id="nav">

            <a href="index.cfm"><img src="images/nav/new/home2.jpg"  width="72" height="41" alt="Home"></a>

<a href="about.cfm"><img src="images/nav/new/about.jpg" width="72" height="41" alt="About Us" id="about"></a>

<a href="services.cfm"><img src="images/nav/new/services.jpg" width="83" height="41" alt="Services"></a>

<a href="membership.cfm"><img src="images/nav/new/member.jpg" width="84" height="41" alt="Membership"></a>

<a href="events.cfm"><img src="images/nav/new/events.jpg" width="64" height="41" alt="Events"></a>

<a href="volunteer.cfm"><img src="images/nav/new/volunteer.jpg" width="72" height="41" alt="Volunteer"></a>

<a href="news.cfm"><img src="images/nav/new/news.jpg" width="64" height="41" alt="News"></a>

<a href="resources.cfm"><img src="images/nav/new/resources.jpg" width="72" height="41" alt="Resources"></a>

                <a href="contact.cfm"><img src="images/nav/new/contactselected.jpg" width="94" height="41" alt="Contact Us"></a> <!--- end nav div ---></div>

<!---end header div--->

</div>

<div id="headline">

            <!---end headline div--->

</div>

<div id="content">

       <h2>Contact Us</h2>

<p>   <table cellpadding="2" cellspacing="2" border="0">

<tr>

    <td class="hdl" colspan="2">If you would like more information about Arc Kandiyohi County, please complete the form below and click send. Thank you for your interest in Arc Kandiyohi County.

        </td>

    </tr>

    <tr>

    <td>Name:</td> <td><cfinput

        type="text"

                                name="name"

                                size="40"

                                required="yes"

                                message="Please enter your Name!"></td>

    </tr>

    <tr>

    <td>Phone Number:</td><td><cfinput

        type="text"

                                        name="phone"

                                        size="12"

                                        required="no"></td>

    </tr>

    <tr>

    <td>Address:</td><td><cfinput

        type="text"

                                    name="add"

                                    size="30"

                                    required="yes"

                                    message="Please enter your Address!"></td>

    </tr>

    <tr>

    <td>City:</td><td><cfinput

        type="text"

                                name="city"

                                size="30"

                                required="yes"

                                message="Please enter your City!"></td>

    </tr>

    <tr>

    <td>State:</td><td><cfinput

        type="text"

                                name="state"

                                size="30"

                                required="yes"

                                message="Please enter your State!"></td>

    </tr>

    <tr>

    <td>Zip Code:</td><td><cfinput

        type="text"

                                    name="zip"

                                    size="10"

                                    required="yes"

                                    message="Please enter your Zip Code!"></td>

    </tr>

    <tr>

    <td>Email Address:</td><td><cfinput

        type="text"

                                        name="email"

                                        size="50"

                                        required="no"></td>

    </tr>

    <tr></tr>

           <tr>

         <td class="hdl" colspan="2">Please leave any additional comments in the box below.</td>

       </tr>

       <tr>

         <td colspan="2"><textarea name="comments" cols="50" rows="5"></textarea></td>

       </tr>

       </table>

        <table width="563">

    <tr>

    <td class="hdl" colspan="5">Please select all programs below that you want to request information for.</td></tr>

        <tr>

              <td width="20"><cfinput type="checkbox" checked="no" name="o1"></td><td width="238">Advocacy, Information and Referral</td>

              <td width="36">         </td>

                    <td width="22"><cfinput type="checkbox" checked="no" name="o2"></td><td width="223">Camperships</td>

          </tr>

                <tr>

                <td><cfinput type="checkbox" checked="no" name="o3"></td><td>Family and Caregiver Support</td><td>         </td>

                    <td><cfinput type="checkbox" checked="no" name="o4"></td><td>Educational Workshops</td>

                </tr>

                <tr>

                     <td><cfinput type="checkbox" checked="no" name="o5"></td><td>People First</td>

                     <td>         </td>

                                     <td><cfinput type="checkbox" checked="no" name="o6"></td><td>Representative Payee Assistant</td>

               </tr>

                <tr>

                    <td><cfinput type="checkbox" checked="no" name="o7"></td><td>Sibshops</td>

                    <td>         </td>

                    <td><cfinput type="checkbox" checked="no" name="o8"></td><td>Special Olympics</td>

               </tr>

                <tr>

                <td><cfinput type="checkbox" checked="no" name="o9"></td><td>Support Groups</td><td>         </td>

                    <td><cfinput type="checkbox" checked="no" name="o10"></td><td>Vacation and Travel Opportunities</td>

               </tr>

            </table>

<table>

      <tr>

      <td class="hdl" colspan="2">If you like additional information about Arc Kandiyohi County, please make your selections below.</td>

      </tr>

                <tr>

                <td><cfinput type="checkbox" checked="no" name="a1"></td><td>Donate Money</td>

               </tr>

                <tr>

                <td><cfinput type="checkbox" checked="no" name="a2"></td><td>Membership</td>

      </tr>

                <tr>

                <td><cfinput type="checkbox" checked="no" name="a3"></td><td>Presentation to my Church or Service Club</td>

               </tr>

                <tr>

                <td><cfinput type="checkbox" checked="no" name="a4"></td><td>Volunteer</td>

                </tr>

                <tr>

                   <td><cfinput type="checkbox" checked="no" name="a5"></td><td>Donate item from our Wish List</td>

      </tr>

    </table>

<br />

<input type="submit" name="Submit" value="Submit"><input type="reset" value="Reset"></p>

</cfform>

             <!---end content div--->  

</div>

<div class="clear"></div>

</div>

            <cfinclude template="footer.cfm">

and contactreceived:

<!--- Add cfparams to prevent errors on the page --->

<cfparam name="FORM.name" default="">

<cfparam name="FORM.add" default="">

<cfparam name="FORM.city" default="">

<cfparam name="FORM.state" default="">

<cfparam name="FORM.zip" default="">

<cfparam name="FORM.comments" default="">

<cfparam name="FORM.o1" default="">

<cfparam name="FORM.o2" default="">

<cfparam name="FORM.o3" default="">

<cfparam name="FORM.o4" default="">

<cfparam name="FORM.o5" default="">

<cfparam name="FORM.o6" default="">

<cfparam name="FORM.o7" default="">

<cfparam name="FORM.o8" default="">

<cfparam name="FORM.o9" default="">

<cfparam name="FORM.o10" default="">

<cfparam name="FORM.a1" default="">

<cfparam name="FORM.a2" default="">

<cfparam name="FORM.a3" default="">

<cfparam name="FORM.a4" default="">

<cfparam name="FORM.a5" default="">

<!--- Create an empty error string --->

<cfset strError = "">

<!--- If the form is submitted --->

<cfif isDefined("FORM.Submit")>

<!--- If the Name field is empty --->

<cfif Len(Trim(FORM.name)) LT 1>

<!--- Add this to the error string --->

<cfset strError = strError & "Please enter your Name!<br>">

</cfif>

<!--- If the address field is empty --->

<cfif Len(Trim(FORM.add)) LT 1>

<!--- Add this to the error string --->

<cfset strError = strError & "Please enter your Address!<br>">

</cfif>

<!--- If the city field is empty --->

<cfif Len(Trim(FORM.city)) LT 1>

<!--- Add this to the error string --->

<cfset strError = strError & "Please enter your City!<br>">

</cfif>

<!--- If the state field is empty --->

<cfif Len(Trim(FORM.state)) LT 1>

<!--- Add this to the error string --->

<cfset strError = strError & "Please enter your State!<br>">

</cfif>

    <!--- If the zip field is empty --->

<cfif Len(Trim(FORM.state)) LT 1>

<!--- Add this to the error string --->

<cfset strError = strError & "Please enter your Zip Code!<br>">

</cfif>

<!--- If the form was not submitted --->

<cfelse>

<!--- Send the user to the form page --->

<cflocation addtoken="no" url="contact.cfm">

</cfif>

<cfinclude template="header2.cfm">     

<div id="nav">

            <a href="index.cfm"><img src="images/nav/new/home2.jpg"  width="72" height="41" alt="Home"></a>

<a href="about.cfm"><img src="images/nav/new/about.jpg" width="72" height="41" alt="About Us" id="about"></a>

<a href="services.cfm"><img src="images/nav/new/services.jpg" width="83" height="41" alt="Services"></a>

<a href="membership.cfm"><img src="images/nav/new/member.jpg" width="84" height="41" alt="Membership"></a>

<a href="events.cfm"><img src="images/nav/new/events.jpg" width="64" height="41" alt="Events"></a>

<a href="volunteer.cfm"><img src="images/nav/new/volunteer.jpg" width="72" height="41" alt="Volunteer"></a>

<a href="news.cfm"><img src="images/nav/new/news.jpg" width="64" height="41" alt="News"></a>

<a href="resources.cfm"><img src="images/nav/new/resources.jpg" width="72" height="41" alt="Resources"></a>

                <a href="contact.cfm"><img src="images/nav/new/contactselected.jpg" width="94" height="41" alt="Contact Us"></a> <!--- end nav div ---></div>

<!---end header div--->

</div>

<div id="headline">

            <!---end headline div--->

</div>

<div id="content">

<!--- If the error string is still empty show the results --->

<cfif strError EQ "">

<p>Thank you for your interest in Arc Kandiyohi County.</p>

<p>Someone will contact you as soon as possible. </p>

<!--- Send the email --->

<cfmail

from="webmaster@kandiarc.com"

to="krazykrisi@hotmail.com"

subject="Online Contact Form Submission"

server="mail.arckandi.org">

Name: #Trim(FORM.name)#

Phone Number: #Trim(FORM.phone)#

Address: #Trim(FORM.add)#

City: #Trim(FORM.city)#

State: #Trim(FORM.state)#

Zip Code: #Trim(FORM.zip)#

Email Address: #Trim(FORM.email)#

Comments: #Trim(FORM.comments)# <br>

<br>

Please select all programs below that you want to request information for.<br>

<br>

Advocacy, Information, Referrel: #Trim(FORM.o1)#

Camperships: #Trim(FORM.o2)#

Family and Caregiver Support: #Trim(FORM.o3)#

Educational Workshops: #Trim(FORM.o4)#

People First: #Trim(FORM.o5)#

Representative Payee Assistant: #Trim(FORM.o6)#

Sibshops: #Trim(FORM.o7)#

Special Olympics: #Trim(FORM.o8)#

Support Groups: #Trim(FORM.o9)#

Vacation and Travel Opportunities: #Trim(FORM.o10)#<br>

<br>

I would like more information about...<br>

<br>

Donate Money: #Trim(FORM.a1)#

Membership: #Trim(FORM.a2)#

Presentation to my Church or Service Club: #Trim(FORM.a3)#

Volunteer: #Trim(FORM.a4)#

Donate item from our Wish List: #Trim(FORM.a5)#

Someone will contact you if necessary.

</cfmail>

    </cfif>

            <cfinclude template="footer.cfm">

If anyone can help that would be great. Thanks!

    This topic has been closed for replies.

    1 reply

    BKBK
    Community Expert
    Community Expert
    December 8, 2009

    What then is the problem?

    Known Participant
    December 8, 2009

    It is not working and I get a different error every time. Is there a different way to do this or am I doing it wrong?

    BKBK
    Community Expert
    Community Expert
    December 8, 2009
    It is not working and I get a different error every time.

    Could you show us the error message(s).