Contact Form Problems
Posted: Sat Sep 11, 2010 4:52 pm
I will start by apologizing for my ignorance as I am brand new at this.
I have built two sites for clients using templates from dreamtemplate.com and they include php contact forms. I have gotten the contact forms to work but cannot get all of the fields to show up in the email that is sent. I have modified fields to suit the needs of the clients and the only information I get when I submit a test form are the variables they installed???
Here is the page: http://westerlyfurniture.com/contact.html
Here is the HTML File:
<!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">
<head>
<title>contact</title>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<link href="style.css" rel="stylesheet" type="text/css" />
<script type="text/javascript" src="js/jquery.js"></script>
<script src="Scripts/swfobject_modified.js" type="text/javascript"></script>
<script type="text/javascript">
// <![CDATA[
jQuery(document).ready(function(){
$('#contactform').submit(function(){
var action = $(this).attr('action');
$.post(action, {
name: $('#name').val(),
address: $('#address').val(),
email: $('#email').val(),
phone: $('#phone').val(),
message: $('#message').val()
},
function(data){
$('#contactform #submit').attr('disabled','');
$('.response').remove();
$('#contactform').before('<p class="response">'+data+'</p>');
$('.response').slideDown();
if(data=='Message sent!') $('#contactform').slideUp();
}
);
return false;
});
});
// ]]>
</script>
</head>
<body>
<div class="main">
<div class="header">
<div class="flash">
<object id="FlashID" classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" width="1000" height="192">
<param name="movie" value="header_contact.swf" />
<param name="quality" value="high" />
<param name="wmode" value="opaque" />
<param name="swfversion" value="8.0.35.0" />
<!-- This param tag prompts users with Flash Player 6.0 r65 and higher to download the latest version of Flash Player. Delete it if you don’t want users to see the prompt. -->
<param name="expressinstall" value="Scripts/expressInstall.swf" />
<!-- Next object tag is for non-IE browsers. So hide it from IE using IECC. -->
<!--[if !IE]>-->
<object type="application/x-shockwave-flash" data="header_contact.swf" width="1000" height="192">
<!--<![endif]-->
<param name="quality" value="high" />
<param name="wmode" value="opaque" />
<param name="swfversion" value="8.0.35.0" />
<param name="expressinstall" value="Scripts/expressInstall.swf" />
<!-- The browser displays the following alternative content for users with Flash Player 6.0 and older. -->
<div>
<h4>Content on this page requires a newer version of Adobe Flash Player.</h4>
<p><a href="http://www.adobe.com/go/getflashplayer"><img src="http://www.adobe.com/images/shared/down ... player.gif" alt="Get Adobe Flash player" width="112" height="33" /></a></p>
</div>
<!--[if !IE]>-->
</object>
<!--<![endif]-->
</object>
</div>
</div>
<div class="body">
<div class="body_resize">
<div class="left">
<h2>Contact Affordable Furnishings</h2>
<p class="back"> Please feel free to fill out our contact form for any additional information you may need or to set up an appointment for a personalized catalog and showroom tour. Please be as detailed as possible and remember that you can always reach us during business hours at (401) 348-6363</p>
<div class="clr"></div>
<h2>Contact form</h2>
<form action="contact.php" method="post" id="contactform">
<ol>
<li>
<label for="name">Name<a href="#">*</a><br />
</label>
<input name="name" class="text" id="name" />
</li>
<li>
<label for="address"><a href="#"></a>Address<br />
</label>
<input id="address" name="address" class="text" />
</li>
<li>
<label for="email">Email*<br />
</label>
<input id="email" name="email" class="text" />
</li>
<li>
<label for="phone">Phone<br />
</label>
<input id="phone" name="phone" class="text" />
</li>
<li>
<label for="message">Message<a href="#">*</a><br />
</label>
<textarea id="message" name="message" rows="6" cols="50"></textarea>
</li>
<li class="buttons">
<input type="image" name="imageField2" id="imageField2" src="images/send.gif" />
</li>
</ol>
</form>
</div>
<div class="right">
<h2>Contact info </h2>
<div class="bg"></div>
<p><strong>Alternate Contact Options</strong></p>
<p>You can reach us by phone or a simple email with the information provided below.</p>
<p>(401) 348-6363<br />
<strong>info@westerlyfurniture.com</strong><br />
</p>
<div class="bg"></div>
<p><strong>Hours</strong></p>
<p>We are open Monday through Friday from 10:00 a.m. until 5:00 p.m., and Saturday from 10:00 a.m. until 3:00 p.m.<br />
<strong>Please click on the map for detailed driving directions to our showroom.</strong><br />
</p>
<p><a href="http://maps.google.com/maps?hl=en&um=1& ... IwAA"><img src="images/map.png" width="256" height="224" /></a></p>
</div>
<div class="clr"></div>
</div>
<div class="clr"></div>
</div>
<div class="footer">
<div class="resize">
<div>© Copyright 2010 Affordable Furnishings. All Rights Reserved<br />
<a href="index.html">Home</a> | <a href="contact.html">Contact</a> | <a href="sitemap.html">Sitemap</a></div>
</div>
<p class="clr"></p>
</div>
</div>
<script type="text/javascript">
<!--
swfobject.registerObject("FlashID");
//-->
</script>
</body>
</html>
Here is the PHP script:
<?php
if(!$_POST) exit;
$email = $_POST['email'];
//$error[] = preg_match('/\b[A-Z0-9._%-]+@[A-Z0-9.-]+\.[A-Z]{2,4}\b/i', $_POST['email']) ? '' : 'INVALID EMAIL ADDRESS';
if(!eregi("^[a-z0-9]+([_\\.-][a-z0-9]+)*" ."@"."([a-z0-9]+([\.-][a-z0-9]+)*)+"."\\.[a-z]{2,}"."$",$email )){
$error.="Invalid email address entered";
$errors=1;
}
if($errors==1) echo $error;
else{
$values = array ('name','address','email','phone','message');
$required = array('name','address','email','phone','message');
$your_email = "info@westerlyfurniture.com";
$email_subject = "New Message: ".$_POST['subject'];
$email_content = "new message:\n";
foreach($values as $key => $value){
if(in_array($value,$required)){
if ($key != 'subject' && $key != 'company') {
if( empty($_POST[$value]) ) { echo 'PLEASE FILL IN REQUIRED FIELDS'; exit; }
}
$email_content .= $value.': '.$_POST[$value]."\n";
}
}
if(@mail($your_email,$email_subject,$email_content)) {
echo 'Message sent!';
} else {
echo 'ERROR!';
}
}
?>
The only information that is delivered to the email address specified is:
new message:
name: jeff Sullivan
email: sully@210usa.com
message: testing third time
I need the email sent to deliver all the information submitted in the contact form and would also like to know how to add extra fields if necessary. I would obviously want them to be included in the email that is finally sent.
Once again I will apologize for my lack of knowledge and expertise. I am trying
I have built two sites for clients using templates from dreamtemplate.com and they include php contact forms. I have gotten the contact forms to work but cannot get all of the fields to show up in the email that is sent. I have modified fields to suit the needs of the clients and the only information I get when I submit a test form are the variables they installed???
Here is the page: http://westerlyfurniture.com/contact.html
Here is the HTML File:
<!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">
<head>
<title>contact</title>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<link href="style.css" rel="stylesheet" type="text/css" />
<script type="text/javascript" src="js/jquery.js"></script>
<script src="Scripts/swfobject_modified.js" type="text/javascript"></script>
<script type="text/javascript">
// <![CDATA[
jQuery(document).ready(function(){
$('#contactform').submit(function(){
var action = $(this).attr('action');
$.post(action, {
name: $('#name').val(),
address: $('#address').val(),
email: $('#email').val(),
phone: $('#phone').val(),
message: $('#message').val()
},
function(data){
$('#contactform #submit').attr('disabled','');
$('.response').remove();
$('#contactform').before('<p class="response">'+data+'</p>');
$('.response').slideDown();
if(data=='Message sent!') $('#contactform').slideUp();
}
);
return false;
});
});
// ]]>
</script>
</head>
<body>
<div class="main">
<div class="header">
<div class="flash">
<object id="FlashID" classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" width="1000" height="192">
<param name="movie" value="header_contact.swf" />
<param name="quality" value="high" />
<param name="wmode" value="opaque" />
<param name="swfversion" value="8.0.35.0" />
<!-- This param tag prompts users with Flash Player 6.0 r65 and higher to download the latest version of Flash Player. Delete it if you don’t want users to see the prompt. -->
<param name="expressinstall" value="Scripts/expressInstall.swf" />
<!-- Next object tag is for non-IE browsers. So hide it from IE using IECC. -->
<!--[if !IE]>-->
<object type="application/x-shockwave-flash" data="header_contact.swf" width="1000" height="192">
<!--<![endif]-->
<param name="quality" value="high" />
<param name="wmode" value="opaque" />
<param name="swfversion" value="8.0.35.0" />
<param name="expressinstall" value="Scripts/expressInstall.swf" />
<!-- The browser displays the following alternative content for users with Flash Player 6.0 and older. -->
<div>
<h4>Content on this page requires a newer version of Adobe Flash Player.</h4>
<p><a href="http://www.adobe.com/go/getflashplayer"><img src="http://www.adobe.com/images/shared/down ... player.gif" alt="Get Adobe Flash player" width="112" height="33" /></a></p>
</div>
<!--[if !IE]>-->
</object>
<!--<![endif]-->
</object>
</div>
</div>
<div class="body">
<div class="body_resize">
<div class="left">
<h2>Contact Affordable Furnishings</h2>
<p class="back"> Please feel free to fill out our contact form for any additional information you may need or to set up an appointment for a personalized catalog and showroom tour. Please be as detailed as possible and remember that you can always reach us during business hours at (401) 348-6363</p>
<div class="clr"></div>
<h2>Contact form</h2>
<form action="contact.php" method="post" id="contactform">
<ol>
<li>
<label for="name">Name<a href="#">*</a><br />
</label>
<input name="name" class="text" id="name" />
</li>
<li>
<label for="address"><a href="#"></a>Address<br />
</label>
<input id="address" name="address" class="text" />
</li>
<li>
<label for="email">Email*<br />
</label>
<input id="email" name="email" class="text" />
</li>
<li>
<label for="phone">Phone<br />
</label>
<input id="phone" name="phone" class="text" />
</li>
<li>
<label for="message">Message<a href="#">*</a><br />
</label>
<textarea id="message" name="message" rows="6" cols="50"></textarea>
</li>
<li class="buttons">
<input type="image" name="imageField2" id="imageField2" src="images/send.gif" />
</li>
</ol>
</form>
</div>
<div class="right">
<h2>Contact info </h2>
<div class="bg"></div>
<p><strong>Alternate Contact Options</strong></p>
<p>You can reach us by phone or a simple email with the information provided below.</p>
<p>(401) 348-6363<br />
<strong>info@westerlyfurniture.com</strong><br />
</p>
<div class="bg"></div>
<p><strong>Hours</strong></p>
<p>We are open Monday through Friday from 10:00 a.m. until 5:00 p.m., and Saturday from 10:00 a.m. until 3:00 p.m.<br />
<strong>Please click on the map for detailed driving directions to our showroom.</strong><br />
</p>
<p><a href="http://maps.google.com/maps?hl=en&um=1& ... IwAA"><img src="images/map.png" width="256" height="224" /></a></p>
</div>
<div class="clr"></div>
</div>
<div class="clr"></div>
</div>
<div class="footer">
<div class="resize">
<div>© Copyright 2010 Affordable Furnishings. All Rights Reserved<br />
<a href="index.html">Home</a> | <a href="contact.html">Contact</a> | <a href="sitemap.html">Sitemap</a></div>
</div>
<p class="clr"></p>
</div>
</div>
<script type="text/javascript">
<!--
swfobject.registerObject("FlashID");
//-->
</script>
</body>
</html>
Here is the PHP script:
<?php
if(!$_POST) exit;
$email = $_POST['email'];
//$error[] = preg_match('/\b[A-Z0-9._%-]+@[A-Z0-9.-]+\.[A-Z]{2,4}\b/i', $_POST['email']) ? '' : 'INVALID EMAIL ADDRESS';
if(!eregi("^[a-z0-9]+([_\\.-][a-z0-9]+)*" ."@"."([a-z0-9]+([\.-][a-z0-9]+)*)+"."\\.[a-z]{2,}"."$",$email )){
$error.="Invalid email address entered";
$errors=1;
}
if($errors==1) echo $error;
else{
$values = array ('name','address','email','phone','message');
$required = array('name','address','email','phone','message');
$your_email = "info@westerlyfurniture.com";
$email_subject = "New Message: ".$_POST['subject'];
$email_content = "new message:\n";
foreach($values as $key => $value){
if(in_array($value,$required)){
if ($key != 'subject' && $key != 'company') {
if( empty($_POST[$value]) ) { echo 'PLEASE FILL IN REQUIRED FIELDS'; exit; }
}
$email_content .= $value.': '.$_POST[$value]."\n";
}
}
if(@mail($your_email,$email_subject,$email_content)) {
echo 'Message sent!';
} else {
echo 'ERROR!';
}
}
?>
The only information that is delivered to the email address specified is:
new message:
name: jeff Sullivan
email: sully@210usa.com
message: testing third time
I need the email sent to deliver all the information submitted in the contact form and would also like to know how to add extra fields if necessary. I would obviously want them to be included in the email that is finally sent.
Once again I will apologize for my lack of knowledge and expertise. I am trying