Webpage Form Sent via Script instead of mailto:

Associate
Joined
6 Feb 2004
Posts
270
Location
Ballymena
Hi i have just created a Form on my webpage collecting details and allowing people to send me comments but i have no idea how to link it so it sends to my email address from my submit form button, I am able to use the mailto: which opens up outlook express or what ever program they use but i don't wan't this, i want it when they click on the submit form button it automatically sends the details to my email and maybe displays a page saying Comments Sent Successfully. I've heard about cgi-bin but this means nothing to me so any help on this is much appreciated so i can get this up and running. If you need the URL here it is: http://www.ryanball.co.uk/contactme.html

Many Thanks in Advance
 
Hi Adam thanks for the link, i saw that form generator but i've already created my form and just need the code that will email it to me i tried creating a new form with the generator and duplicating the code into my form but when i click on the submit button it was just taking me to error.htm Any Advice ?
 
Hi i'm not very experienced at webdesign as you can see so i just used dreamweavers buttons available, all suggestions welcome :) what i'll do next is post the contactme.html & contactme.php to see if you can help me, i've fixed it a little but still not exactly as i want it, i should be receiving several pieces of information in my email:

1: Name
2 Email Address
3: Comments
4: Newsletter Yes/No
5: Where they heard about me
6: How many times Hypnotised

when i click submit i'm getting an email but only 5 & 6 are coming through in the email
 
Here's my contactme.html:

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"><!-- InstanceBegin template="/Templates/main_template.dwt" codeOutsideHTMLIsLocked="false" -->
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<!-- InstanceBeginEditable name="doctitle" -->
<title>Ryan Ball Hypnotherapy - Ballymena, Northern Ireland - Hypnosis, Hypnotherapy, Psychology, Weight Loss, Stop Smoking</title>
<!-- InstanceEndEditable -->
<style type="text/css">
<!--
body {
margin-left: 0px;
margin-top: 0px;
margin-right: 0px;
margin-bottom: 0px;
}
.style2 {
font-size: 14px;
color: #FFFFFF;
font-weight: bold;
}
a:link {
color: #000000;
}
a:visited {
color: #6FC1D9;
}
a:hover {
color: #336FAB;
}
body,td,th {
font-family: Arial, Helvetica, sans-serif;
}
.style3 {
font-size: 12px
}
-->
</style>
<!-- InstanceBeginEditable name="head" --><!-- InstanceEndEditable -->
<script src="Scripts/AC_RunActiveContent.js" type="text/javascript"></script>
</head>

<body>
<table width="850" height="558" border="0" align="center">
<tr>
<td width="300"><img src="Assets/Images/ryan_ball_hypnotherapy_logo.gif" width="300" height="75" alt="Ryan Ball Hypnotherapy Logo" /></td>
<td width="590" valign="middle" bgcolor="#A84A09"><div align="center">
<p>
<script type="text/javascript">
AC_FL_RunContent( 'codebase','http://download.macromedia.com/pub/...kwaveFlash','bgcolor','#A84A09','movie','home' ); //end AC code
</script>
<noscript>
<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=5,0,0,0" width="100" height="23" title="Home">
<param name="movie" value="home.swf" />
<param name="quality" value="high" />
<param name="bgcolor" value="#A84A09" />
<embed src="home.swf" quality="high" pluginspage="http://www.adobe.com/shockwave/download/download.cgi?P1_Prod_Version=ShockwaveFlash" type="application/x-shockwave-flash" width="100" height="23" bgcolor="#A84A09"></embed>
</object>
</noscript>
<script type="text/javascript">
AC_FL_RunContent( 'codebase','http://download.macromedia.com/pub/...0','width','100','height','23','title','About Me','src','aboutme','quality','high','pluginspage','http://www.adobe.com/shockwave/down...veFlash','bgcolor','#A84A09','movie','aboutme' ); //end AC code
</script>
<noscript>
<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=5,0,0,0" width="100" height="23" title="About Me">
<param name="movie" value="aboutme.swf" />
<param name="quality" value="high" />
<param name="bgcolor" value="#A84A09" />
<embed src="aboutme.swf" quality="high" pluginspage="http://www.adobe.com/shockwave/download/download.cgi?P1_Prod_Version=ShockwaveFlash" type="application/x-shockwave-flash" width="100" height="23" bgcolor="#A84A09"></embed>
</object>
</noscript>
<script type="text/javascript">
AC_FL_RunContent( 'codebase','http://download.macromedia.com/pub/...ckwaveFlash','bgcolor','#A84A09','movie','faq' ); //end AC code
</script>
<noscript>
<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=5,0,0,0" width="100" height="23" title="F.A.Q.">
<param name="movie" value="faq.swf" />
<param name="quality" value="high" />
<param name="bgcolor" value="#A84A09" />
<embed src="faq.swf" quality="high" pluginspage="http://www.adobe.com/shockwave/download/download.cgi?P1_Prod_Version=ShockwaveFlash" type="application/x-shockwave-flash" width="100" height="23" bgcolor="#A84A09"></embed>
</object>
</noscript>
<script type="text/javascript">
AC_FL_RunContent( 'codebase','http://download.macromedia.com/pub/...lash','bgcolor','#A84A09','movie','treatments' ); //end AC code
</script>
<noscript>
<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=5,0,0,0" width="100" height="23" title="Treatments">
<param name="movie" value="treatments.swf" />
<param name="quality" value="high" />
<param name="bgcolor" value="#A84A09" />
<embed src="treatments.swf" quality="high" pluginspage="http://www.adobe.com/shockwave/download/download.cgi?P1_Prod_Version=ShockwaveFlash" type="application/x-shockwave-flash" width="100" height="23" bgcolor="#A84A09"></embed>
</object>
</noscript>
<script type="text/javascript">
AC_FL_RunContent( 'codebase','http://download.macromedia.com/pub/...sh','bgcolor','#A84A09','movie','testimonials' ); //end AC code
</script>
<noscript>
<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=5,0,0,0" width="100" height="23" title="Testimonials">
<param name="movie" value="testimonials.swf" />
<param name="quality" value="high" />
<param name="bgcolor" value="#A84A09" />
<embed src="testimonials.swf" quality="high" pluginspage="http://www.adobe.com/shockwave/download/download.cgi?P1_Prod_Version=ShockwaveFlash" type="application/x-shockwave-flash" width="100" height="23" bgcolor="#A84A09"></embed>
</object>
</noscript>
<br />
<script type="text/javascript">
AC_FL_RunContent( 'codebase','http://download.macromedia.com/pub/...kwaveFlash','bgcolor','#A84A09','movie','fees' ); //end AC code
</script><noscript><object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=5,0,0,0" width="100" height="23" title="Fees">
<param name="movie" value="fees.swf" />
<param name="quality" value="high" />
<param name="bgcolor" value="#A84A09" />
<embed src="fees.swf" quality="high" pluginspage="http://www.adobe.com/shockwave/download/download.cgi?P1_Prod_Version=ShockwaveFlash" type="application/x-shockwave-flash" width="100" height="23" bgcolor="#A84A09"></embed>
</object></noscript>
<script type="text/javascript">
AC_FL_RunContent( 'codebase','http://download.macromedia.com/pub/...waveFlash','bgcolor','#A84A09','movie','forum' ); //end AC code
</script><noscript><object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=5,0,0,0" width="100" height="23" title="Forum">
<param name="movie" value="forum.swf" />
<param name="quality" value="high" />
<param name="bgcolor" value="#A84A09" />
<embed src="forum.swf" quality="high" pluginspage="http://www.adobe.com/shockwave/download/download.cgi?P1_Prod_Version=ShockwaveFlash" type="application/x-shockwave-flash" width="100" height="23" bgcolor="#A84A09"></embed>
</object></noscript>
<script type="text/javascript">
AC_FL_RunContent( 'codebase','http://download.macromedia.com/pub/...,0','width','100','height','23','title','Live Chat','src','livechat','quality','high','pluginspage','http://www.adobe.com/shockwave/down...eFlash','bgcolor','#A84A09','movie','livechat' ); //end AC code
</script><noscript><object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=5,0,0,0" width="100" height="23" title="Live Chat">
<param name="movie" value="livechat.swf" />
<param name="quality" value="high" />
<param name="bgcolor" value="#A84A09" />
<embed src="livechat.swf" quality="high" pluginspage="http://www.adobe.com/shockwave/download/download.cgi?P1_Prod_Version=ShockwaveFlash" type="application/x-shockwave-flash" width="100" height="23" bgcolor="#A84A09"></embed>
</object></noscript>
<script type="text/javascript">
AC_FL_RunContent( 'codebase','http://download.macromedia.com/pub/...waveFlash','bgcolor','#A84A09','movie','links' ); //end AC code
</script><noscript><object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=5,0,0,0" width="100" height="23" title="Links">
<param name="movie" value="links.swf" />
<param name="quality" value="high" />
<param name="bgcolor" value="#A84A09" />
<embed src="links.swf" quality="high" pluginspage="http://www.adobe.com/shockwave/download/download.cgi?P1_Prod_Version=ShockwaveFlash" type="application/x-shockwave-flash" width="100" height="23" bgcolor="#A84A09"></embed>
</object></noscript>
<script type="text/javascript">
AC_FL_RunContent( 'codebase','http://download.macromedia.com/pub/...,'width','100','height','23','title','Contact Me','src','contactme','quality','high','pluginspage','http://www.adobe.com/shockwave/down...Flash','bgcolor','#A84A09','movie','contactme' ); //end AC code
</script><noscript><object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=5,0,0,0" width="100" height="23" title="Contact Me">
<param name="movie" value="contactme.swf" />
<param name="quality" value="high" />
<param name="bgcolor" value="#A84A09" />
<embed src="contactme.swf" quality="high" pluginspage="http://www.adobe.com/shockwave/download/download.cgi?P1_Prod_Version=ShockwaveFlash" type="application/x-shockwave-flash" width="100" height="23" bgcolor="#A84A09"></embed>
</object></noscript>
<br />
</p>
</div></td>
</tr>
<tr valign="top">
<td height="452"><img src="Assets/Images/hypno_logo.jpg" width="300" height="475" /></td>
<td valign="top" bgcolor="#3C81C4"><!-- InstanceBeginEditable name="main_page" -->
<table width="100%" border="0">
<tr>
<td height="460"><form id="contactme" name="contactme" method="post" action="contactme.php">
<table width="100%" height="35" border="0">
<tr>
<td width="39%" align="right" valign="top"><label for="name">Name:</label></td>
<td width="61%"><input name="name" type="text" id="name" value="Type your full name here" size="30" /></td>
</tr>
<tr>
<td align="right" valign="top"><label for="email">Email Address:</label></td>
<td><input name="email" type="text" id="email" size="30" /></td>
</tr>
<tr>
<td align="right" valign="top"><label for="comments">Comments:</label></td>
<td><textarea name="comments" id="comments" cols="30" rows="5"></textarea></td>
</tr>
<tr>
<td align="right" valign="top">&nbsp;</td>
<td><label>
<input name="newsletter" type="checkbox" id="newsletter" value="Yes" />
Add me to the Ryan Ball<br />
Hypnotherapy Newsletter</label>
<label for="newsletter"></label></td>
</tr>
<tr>
<td align="right" valign="top">Where did you hear about Ryan Ball Hypnotherapy?</td>
<td><p>
<label>
<input type="radio" name="referrals" value="newspaper" id="Referrals_0" />
Newspaper Ad</label>
<br />
<label>
<input type="radio" name="referrals" value="tv" id="Referrals_1" />
TV Ad</label>
<br />
<label>
<input type="radio" name="referrals" value="radio" id="Referrals_2" />
Radio Ad</label>
<br />
<label>
<input type="radio" name="referrals" value="search engine" id="Referrals_3" />
Search Engine</label>
<br />
<label>
<input type="radio" name="referrals" value="friend" id="Referrals_4" />
Friend</label>
<br />
<label>
<input type="radio" name="referrals" id="radio" value="businesscard/flyer" />
Business Card / Flyer</label>
<br />
</p> </td>
</tr>
<tr>
<td align="right" valign="top"><label for="before">Have you had Hypnotherapy before?</label></td>
<td><select name="before" id="before">
<option selected="selected">Select from menu</option>
<option value="never">Never</option>
<option value="1-6">1-6 Times</option>
<option value="7-12">7-12 Times</option>
<option value="13-18">13-18 Times</option>
<option value="19-24">19-24 Times</option>
<option value="25-30">25-30 Times</option>
<option value="30+">30+ Times</option>
</select></td>
</tr>
<tr>
<td align="right" valign="top">&nbsp;</td>
<td><br />
<input type="reset" name="reset" id="reset" value="Clear Form" />
<input type="submit" name="submit" id="button" value="Submit Form" />
<br /></td>
</tr>
</table>
</form>
</td>
</tr>
</table>
<!-- InstanceEndEditable --></td>
</tr>
<tr>
<td colspan="2" bgcolor="#A84A09"><div align="center"><span class="style2"><a href="index.html">Home</a> | <a href="aboutme.html">About me</a> | <a href="faqs.html">F.A.Q's</a> | <a href="treatments.html">Treatments</a> | <a href="testimonials.html">Testimonials</a> | <a href="fees.html">Fees</a> | <a href="http://www.ryanball.co.uk/Forum/index.php" target="_blank">Forum</a> | <a href="http://www.ryanball.co.uk/Chat/flashchat.php" target="_blank">Live Chat</a> | <a href="links.html">Links</a> | <a href="contactme.html">Contact Me</a></span></div></td>
</tr>
<tr>
<td colspan="2"><div align="center" class="style3">&copy; 2008 Ryan Ball Hypnotherapy. <a href="#">Privacy policy</a> | <a href="#">Terms of use</a></div></td>
</tr>
</table>

<map name="Map" id="Map">
<area shape="rect" coords="84,9,149,23" href="aboutme.html" alt="About Me" /><area shape="rect" coords="23,9,63,23" href="index.html" alt="Home" />
<area shape="rect" coords="178,9,226,25" href="faqs.html" alt="F.A.Q's" />
<area shape="rect" coords="248,9,320,24" href="treatments.html" alt="Treatments" />
<area shape="rect" coords="341,9,425,24" href="testimonials.html" alt="Testimonials" />
<area shape="rect" coords="446,8,482,25" href="fees.html" alt="Fees" />
<area shape="rect" coords="22,49,89,66" href="#" alt="Directions" />
<area shape="rect" coords="122,48,172,66" href="http://www.ryanball.co.uk/Forum/index.php" target="_blank" alt="Forums" />
<area shape="rect" coords="215,49,280,68" href="http://www.ryanball.co.uk/Chat/flashchat.php" target="_blank" alt="Live Chat" />
<area shape="rect" coords="412,46,489,66" href="contactme.html" alt="Contact Me" />
<area shape="rect" coords="338,49,377,65" href="links.html" alt="Lniks" />
</map></body>
<!-- InstanceEnd --></html>

Here's my contactme.php

<?php
// where the email will be sent

$to = '[email protected]';

//get the variables from the form, and sanitise the input

$subject = "Contact Form";
$email = preg_replace('/[ ^a-zA-Z\'\ \&\-\,\.\"\(\)]/', '', $_POST["email"]) ;
$message = preg_replace('/[ ^a-zA-Z\'\ \&\-\,\.\"\(\)]/', '', $_POST["comments"]) ;

$message = wordwrap($message, 70);

$message = $message . "\n\nWhere did you hear about Ryan Ball Hypnotherapy? ".$_POST["referrals"] . "\n\nHave you had hypnotherapy before? " . $_POST["before"];


//format the email
$from = "From: ".$email ;
$replyto = "Reply-To:".$email ;
$headers = $from . "\r\n" . $replyto . "\r\n" . 'X-Mailer: PHP/' . phpversion();


//make sure the form has been filled in before sending
if($subject && $email && $message){ mail($to, $subject, $message, $headers); }

else { echo "You must supply your all the details - Email not sent!";
}

?>

<html><head><title>Thank you for your comments</title></head><body><br>Thank you for your feedback!</font></body></html>


Many Thanks in advance
 
ahhhh use the code tags

Code:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"><!-- InstanceBegin template="/Templates/main_template.dwt" codeOutsideHTMLIsLocked="false" -->
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<!-- InstanceBeginEditable name="doctitle" -->
<title>Ryan Ball Hypnotherapy - Ballymena, Northern Ireland - Hypnosis, Hypnotherapy, Psychology, Weight Loss, Stop Smoking</title>
<!-- InstanceEndEditable -->
<style type="text/css">
<!--
body {
	margin-left: 0px;
	margin-top: 0px;
	margin-right: 0px;
	margin-bottom: 0px;
}
.style2 {
	font-size: 14px;
	color: #FFFFFF;
	font-weight: bold;
}
a:link {
	color: #000000;
}
a:visited {
	color: #6FC1D9;
}
a:hover {
	color: #336FAB;
}
body,td,th {
	font-family: Arial, Helvetica, sans-serif;
}
.style3 {
	font-size: 12px
}
-->
</style>
<!-- InstanceBeginEditable name="head" --><!-- InstanceEndEditable -->
<script src="Scripts/AC_RunActiveContent.js" type="text/javascript"></script>
</head>

<body>
<table width="850" height="558" border="0" align="center">
  <tr>
<td width="300"><img src="Assets/Images/ryan_ball_hypnotherapy_logo.gif" width="300" height="75" alt="Ryan Ball Hypnotherapy Logo" /></td>
    <td width="590" valign="middle" bgcolor="#A84A09"><div align="center">
      <p>
        <script type="text/javascript">
AC_FL_RunContent( 'codebase','http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=5,0,0,0','width','100','height ','23','title','Home','src','home','quality','high ','pluginspage','http://www.adobe.com/shockwave/download/download.cgi?P1_Prod_Version=ShockwaveFlash','bgco lor','#A84A09','movie','home' ); //end AC code
      </script>
        <noscript>
          <object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=5,0,0,0" width="100" height="23" title="Home">
            <param name="movie" value="home.swf" />
            <param name="quality" value="high" />
            <param name="bgcolor" value="#A84A09" />
<embed src="home.swf" quality="high" pluginspage="http://www.adobe.com/shockwave/download/download.cgi?P1_Prod_Version=ShockwaveFlash" type="application/x-shockwave-flash" width="100" height="23" bgcolor="#A84A09"></embed>
          </object>
          </noscript>
        <script type="text/javascript">
AC_FL_RunContent( 'codebase','http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=5,0,0,0','width','100','height ','23','title','About Me','src','aboutme','quality','high','pluginspage' ,'http://www.adobe.com/shockwave/download/download.cgi?P1_Prod_Version=ShockwaveFlash','bgco lor','#A84A09','movie','aboutme' ); //end AC code
      </script>
        <noscript>
          <object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=5,0,0,0" width="100" height="23" title="About Me">
            <param name="movie" value="aboutme.swf" />
            <param name="quality" value="high" />
            <param name="bgcolor" value="#A84A09" />
<embed src="aboutme.swf" quality="high" pluginspage="http://www.adobe.com/shockwave/download/download.cgi?P1_Prod_Version=ShockwaveFlash" type="application/x-shockwave-flash" width="100" height="23" bgcolor="#A84A09"></embed>
        </object>
          </noscript>
        <script type="text/javascript">
AC_FL_RunContent( 'codebase','http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=5,0,0,0','width','100','height ','23','title','F.A.Q.','src','faq','quality','hig h','pluginspage','http://www.adobe.com/shockwave/download/download.cgi?P1_Prod_Version=ShockwaveFlash','bgco lor','#A84A09','movie','faq' ); //end AC code
      </script>
        <noscript>
          <object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=5,0,0,0" width="100" height="23" title="F.A.Q.">
            <param name="movie" value="faq.swf" />
            <param name="quality" value="high" />
            <param name="bgcolor" value="#A84A09" />
<embed src="faq.swf" quality="high" pluginspage="http://www.adobe.com/shockwave/download/download.cgi?P1_Prod_Version=ShockwaveFlash" type="application/x-shockwave-flash" width="100" height="23" bgcolor="#A84A09"></embed>
        </object>
          </noscript>
        <script type="text/javascript">
AC_FL_RunContent( 'codebase','http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=5,0,0,0','width','100','height ','23','title','Treatments','src','treatments','qu ality','high','pluginspage','http://www.adobe.com/shockwave/download/download.cgi?P1_Prod_Version=ShockwaveFlash','bgco lor','#A84A09','movie','treatments' ); //end AC code
      </script>
        <noscript>
          <object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=5,0,0,0" width="100" height="23" title="Treatments">
            <param name="movie" value="treatments.swf" />
            <param name="quality" value="high" />
            <param name="bgcolor" value="#A84A09" />
<embed src="treatments.swf" quality="high" pluginspage="http://www.adobe.com/shockwave/download/download.cgi?P1_Prod_Version=ShockwaveFlash" type="application/x-shockwave-flash" width="100" height="23" bgcolor="#A84A09"></embed>
        </object>
          </noscript>
        <script type="text/javascript">
AC_FL_RunContent( 'codebase','http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=5,0,0,0','width','100','height ','23','title','Testimonials','src','testimonials' ,'quality','high','pluginspage','http://www.adobe.com/shockwave/download/download.cgi?P1_Prod_Version=ShockwaveFlash','bgco lor','#A84A09','movie','testimonials' ); //end AC code
      </script>
        <noscript>
          <object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=5,0,0,0" width="100" height="23" title="Testimonials">
            <param name="movie" value="testimonials.swf" />
            <param name="quality" value="high" />
            <param name="bgcolor" value="#A84A09" />
<embed src="testimonials.swf" quality="high" pluginspage="http://www.adobe.com/shockwave/download/download.cgi?P1_Prod_Version=ShockwaveFlash" type="application/x-shockwave-flash" width="100" height="23" bgcolor="#A84A09"></embed>
        </object>
          </noscript>
        <br />
        <script type="text/javascript">
AC_FL_RunContent( 'codebase','http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=5,0,0,0','width','100','height ','23','title','Fees','src','fees','quality','high ','pluginspage','http://www.adobe.com/shockwave/download/download.cgi?P1_Prod_Version=ShockwaveFlash','bgco lor','#A84A09','movie','fees' ); //end AC code
</script><noscript><object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=5,0,0,0" width="100" height="23" title="Fees">
          <param name="movie" value="fees.swf" />
          <param name="quality" value="high" />
          <param name="bgcolor" value="#A84A09" />
<embed src="fees.swf" quality="high" pluginspage="http://www.adobe.com/shockwave/download/download.cgi?P1_Prod_Version=ShockwaveFlash" type="application/x-shockwave-flash" width="100" height="23" bgcolor="#A84A09"></embed>
        </object></noscript>
        <script type="text/javascript">
AC_FL_RunContent( 'codebase','http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=5,0,0,0','width','100','height ','23','title','Forum','src','forum','quality','hi gh','pluginspage','http://www.adobe.com/shockwave/download/download.cgi?P1_Prod_Version=ShockwaveFlash','bgco lor','#A84A09','movie','forum' ); //end AC code
</script><noscript><object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=5,0,0,0" width="100" height="23" title="Forum">
          <param name="movie" value="forum.swf" />
          <param name="quality" value="high" />
          <param name="bgcolor" value="#A84A09" />
<embed src="forum.swf" quality="high" pluginspage="http://www.adobe.com/shockwave/download/download.cgi?P1_Prod_Version=ShockwaveFlash" type="application/x-shockwave-flash" width="100" height="23" bgcolor="#A84A09"></embed>
        </object></noscript>
        <script type="text/javascript">
AC_FL_RunContent( 'codebase','http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=5,0,0,0','width','100','height ','23','title','Live Chat','src','livechat','quality','high','pluginspa ge','http://www.adobe.com/shockwave/download/download.cgi?P1_Prod_Version=ShockwaveFlash','bgco lor','#A84A09','movie','livechat' ); //end AC code
</script><noscript><object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=5,0,0,0" width="100" height="23" title="Live Chat">
          <param name="movie" value="livechat.swf" />
          <param name="quality" value="high" />
          <param name="bgcolor" value="#A84A09" />
<embed src="livechat.swf" quality="high" pluginspage="http://www.adobe.com/shockwave/download/download.cgi?P1_Prod_Version=ShockwaveFlash" type="application/x-shockwave-flash" width="100" height="23" bgcolor="#A84A09"></embed>
        </object></noscript>
        <script type="text/javascript">
AC_FL_RunContent( 'codebase','http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=5,0,0,0','width','100','height ','23','title','Links','src','links','quality','hi gh','pluginspage','http://www.adobe.com/shockwave/download/download.cgi?P1_Prod_Version=ShockwaveFlash','bgco lor','#A84A09','movie','links' ); //end AC code
</script><noscript><object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=5,0,0,0" width="100" height="23" title="Links">
          <param name="movie" value="links.swf" />
          <param name="quality" value="high" />
          <param name="bgcolor" value="#A84A09" />
<embed src="links.swf" quality="high" pluginspage="http://www.adobe.com/shockwave/download/download.cgi?P1_Prod_Version=ShockwaveFlash" type="application/x-shockwave-flash" width="100" height="23" bgcolor="#A84A09"></embed>
        </object></noscript>
        <script type="text/javascript">
AC_FL_RunContent( 'codebase','http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=5,0,0,0','width','100','height ','23','title','Contact Me','src','contactme','quality','high','pluginspag e','http://www.adobe.com/shockwave/download/download.cgi?P1_Prod_Version=ShockwaveFlash','bgco lor','#A84A09','movie','contactme' ); //end AC code
</script><noscript><object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=5,0,0,0" width="100" height="23" title="Contact Me">
          <param name="movie" value="contactme.swf" />
          <param name="quality" value="high" />
          <param name="bgcolor" value="#A84A09" />
<embed src="contactme.swf" quality="high" pluginspage="http://www.adobe.com/shockwave/download/download.cgi?P1_Prod_Version=ShockwaveFlash" type="application/x-shockwave-flash" width="100" height="23" bgcolor="#A84A09"></embed>
        </object></noscript>
        <br />
      </p>
    </div></td>
  </tr>
  <tr valign="top">
    <td height="452"><img src="Assets/Images/hypno_logo.jpg" width="300" height="475" /></td>
    <td valign="top" bgcolor="#3C81C4"><!-- InstanceBeginEditable name="main_page" -->
      <table width="100%" border="0">
        <tr>
          <td height="460"><form id="contactme" name="contactme" method="post" action="contactme.php">
            <table width="100%" height="35" border="0">
              <tr>
                <td width="39%" align="right" valign="top"><label for="name">Name:</label></td>
<td width="61%"><input name="name" type="text" id="name" value="Type your full name here" size="30" /></td>
              </tr>
              <tr>
                <td align="right" valign="top"><label for="email">Email Address:</label></td>
                <td><input name="email" type="text" id="email" size="30" /></td>
              </tr>
              <tr>
                <td align="right" valign="top"><label for="comments">Comments:</label></td>
                <td><textarea name="comments" id="comments" cols="30" rows="5"></textarea></td>
              </tr>
              <tr>
                <td align="right" valign="top">&nbsp;</td>
                <td><label>
<input name="newsletter" type="checkbox" id="newsletter" value="Yes" />                  
Add me to the Ryan Ball<br />
Hypnotherapy Newsletter</label>                  
                  <label for="newsletter"></label></td>
              </tr>
              <tr>
                <td align="right" valign="top">Where did you hear about Ryan Ball Hypnotherapy?</td>
                <td><p>
                  <label>
                    <input type="radio" name="referrals" value="newspaper" id="Referrals_0" />
                    Newspaper Ad</label>
                  <br />
                  <label>
<input type="radio" name="referrals" value="tv" id="Referrals_1" /> 
TV Ad</label>
                  <br />
                  <label>
                    <input type="radio" name="referrals" value="radio" id="Referrals_2" />
                    Radio Ad</label>
                  <br />
                  <label>
                    <input type="radio" name="referrals" value="search engine" id="Referrals_3" />
                    Search Engine</label>
                  <br />
                  <label>
                    <input type="radio" name="referrals" value="friend" id="Referrals_4" />
                    Friend</label>
                  <br />
                  <label>
                  <input type="radio" name="referrals" id="radio" value="businesscard/flyer" />
                  Business Card / Flyer</label>
                  <br />
                    </p>                  </td>
              </tr>
              <tr>
<td align="right" valign="top"><label for="before">Have you had Hypnotherapy before?</label></td>
                <td><select name="before" id="before">
                      <option selected="selected">Select from menu</option>
                      <option value="never">Never</option>
                      <option value="1-6">1-6 Times</option>
                      <option value="7-12">7-12 Times</option>
                      <option value="13-18">13-18 Times</option>
                      <option value="19-24">19-24 Times</option>
                      <option value="25-30">25-30 Times</option>
                      <option value="30+">30+ Times</option>
                                                                                                    </select></td>
              </tr>
              <tr>
                <td align="right" valign="top">&nbsp;</td>
                <td><br />
                    <input type="reset" name="reset" id="reset" value="Clear Form" />
                     <input type="submit" name="submit" id="button" value="Submit Form" />
                  <br /></td>
              </tr>
            </table>
                    </form>
          </td>
        </tr>
      </table>
    <!-- InstanceEndEditable --></td>
  </tr>
  <tr>
<td colspan="2" bgcolor="#A84A09"><div align="center"><span class="style2"><a href="index.html">Home</a> | <a href="aboutme.html">About me</a> | <a href="faqs.html">F.A.Q's</a> | <a href="treatments.html">Treatments</a> | <a href="testimonials.html">Testimonials</a> | <a href="fees.html">Fees</a> | <a href="http://www.ryanball.co.uk/Forum/index.php" target="_blank">Forum</a> | <a href="http://www.ryanball.co.uk/Chat/flashchat.php" target="_blank">Live Chat</a> | <a href="links.html">Links</a> | <a href="contactme.html">Contact Me</a></span></div></td>
  </tr>
  <tr>
<td colspan="2"><div align="center" class="style3">&copy; 2008 Ryan Ball Hypnotherapy. <a href="#">Privacy policy</a> | <a href="#">Terms of use</a></div></td>
  </tr>
</table>

<map name="Map" id="Map">
 <area shape="rect" coords="84,9,149,23" href="aboutme.html" alt="About Me" /><area shape="rect" coords="23,9,63,23" href="index.html" alt="Home" />
<area shape="rect" coords="178,9,226,25" href="faqs.html" alt="F.A.Q's" />
<area shape="rect" coords="248,9,320,24" href="treatments.html" alt="Treatments" />
<area shape="rect" coords="341,9,425,24" href="testimonials.html" alt="Testimonials" />
<area shape="rect" coords="446,8,482,25" href="fees.html" alt="Fees" />
<area shape="rect" coords="22,49,89,66" href="#" alt="Directions" />
<area shape="rect" coords="122,48,172,66" href="http://www.ryanball.co.uk/Forum/index.php" target="_blank" alt="Forums" />
<area shape="rect" coords="215,49,280,68" href="http://www.ryanball.co.uk/Chat/flashchat.php" target="_blank" alt="Live Chat" />
<area shape="rect" coords="412,46,489,66" href="contactme.html" alt="Contact Me" />
<area shape="rect" coords="338,49,377,65" href="links.html" alt="Lniks" />
</map></body>
<!-- InstanceEnd --></html>

PHP:
<?php
// where the email will be sent

$to      = '[email protected]';

//get the variables from the form, and sanitise the input

$subject =  "Contact Form";
$email = preg_replace('/[ ^a-zA-Z\'\ \&\-\,\.\"\(\)]/', '', $_POST["email"]) ;
$message =  preg_replace('/[ ^a-zA-Z\'\ \&\-\,\.\"\(\)]/', '', $_POST["comments"]) ;

$message =  wordwrap($message, 70);

$message = $message . "\n\nWhere did you hear about Ryan Ball Hypnotherapy? ".$_POST["referrals"] . "\n\nHave you had hypnotherapy before? " . $_POST["before"];


//format the email
$from    =  "From: ".$email ;
$replyto = "Reply-To:".$email ;
$headers = $from . "\r\n" .   $replyto . "\r\n" .   'X-Mailer: PHP/' . phpversion();


//make sure the form has been filled in before sending
if($subject && $email && $message){ mail($to, $subject, $message, $headers); }

else { echo "You must supply your all the details - Email not sent!"; 
} 

?>
 
Replace your contact.php file with the following. Tested and works. It's a quick example so looks pretty basic, so if you need any help modifying the code let 'us' ;-) know.

PHP:
<?php
// where the email will be sent

$to      = ''; - // insert your email

//get the variables from the form, and sanitise the input

$subject =  "Contact Form";
$email = stripslashes($_POST["email"]) ;
$message =  stripslashes($_POST["comments"]) ;

$message =  wordwrap($message, 70);

$message .= "\n\nWhere did you hear about Ryan Ball Hypnotherapy? ".$_POST["referrals"] . "\n\nHave you had hypnotherapy before? " . $_POST["before"];


//format the email
$from    =  "From: ".$email ;
$replyto = "Reply-To:".$email ;
$headers = $from . "\r\n" .   $replyto . "\r\n" .   'X-Mailer: PHP/' . phpversion();


//make sure the form has been filled in before sending
if($subject && $email && $message){ mail($to, $subject, $message, $headers); 
echo "Message sent";
}

else { echo "You must supply your all the details - Email not sent!"; 
} 

?>
 
Back
Top Bottom