stryker9603
08-19-09, 10:39 PM
Good Evening everyone. Newbee here so please be gentle. Here is what I am trying to do
I have a contact.html page that asks users for name, e-mail and a message. once I click on submit I would like the page to call my contact.php page and send an e-mail to me with said information. I have listed the code below but I cant get it to work. any help would be much appreciated.
contact.html 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">
<head>
<title>My title</title>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<link href="flow.css" rel="stylesheet" type="text/css" />
<style type="text/css">
<!--
body,td,th {
color: #28042d;
}
#apDiv1 {
position:absolute;
width:188px;
height:113px;
z-index:1;
left: 38px;
top: 48px;
}
#apDiv2 {
position:absolute;
width:200px;
height:113px;
z-index:2;
left: 880px;
top: 48px;
}
#apDiv3 {
position:absolute;
width:200px;
height:115px;
z-index:3;
left: 414px;
top: 48px;
}
#apDiv4 {
position:absolute;
width:200px;
height:46px;
z-index:4;
left: 450px;
top: 0px;
}
#apDiv5 {
position:absolute;
width:200px;
height:40px;
z-index:5;
left: 450px;
top: 489px;
}
#apDiv6 {
position:absolute;
width:618px;
height:217px;
z-index:6;
left: 237px;
top: 284px;
}
-->
</style></head>
<body class="sub">
<div id="apDiv4"> <td class="NavigationColor"><h4 align="center"><a href="index.html">Home</a> </a> <a href="contact.html">Contact</a> <a href="about.html"> About</a> <a href="privacy.html">Privacy</a></h4></td></div>
<div id="apDiv6">
<form>
<form name="contact_form" action="contact.php" method="get">
<center>
<table width="567" height="175" border="0" cellpadding="0" cellspacing="0" bgcolor="#c1c2d9">
<tr> </tr>
<tr>
<td height="28" valign="top"><table width="456" border="0" cellspacing="0" cellpadding="0">
<tr>
<td width="124" align="right" class="text_1">Your name:</td>
<td width="26"><img src="images/spacer.gif" width="1" height="1" /></td>
<td><input name="your_name" type="text" class="form_1" /></td>
</tr>
</table></td>
</tr>
<tr>
<td height="28" valign="top"><table width="456" border="0" cellspacing="0" cellpadding="0">
<tr>
<td width="124" height="33" align="right" class="text_1">E-mail address:</td>
<td width="26"><img src="images/spacer.gif" width="1" height="1" /></td>
<td><input name="your_email" type="text" class="form_1" /></td>
</tr>
</table></td>
</tr>
<tr>
<td height="91" valign="top"><table width="469" border="0" cellspacing="0" cellpadding="0">
<tr>
<td width="124" align="right" valign="top" class="text_1" style="padding-top:3px ">Message:</td>
<td width="26"><img src="images/spacer.gif" width="1" height="1" /></td>
<td><textarea name="message" class="form_2"></textarea></td>
</tr>
</table></td>
</tr>
<tr>
<td valign="top"><input type="image" src="images/submit.gif" style="margin-left:29px;" onClick="submit();">
<input type="image" src="images/reset.gif" style="margin-left:338px " /></td>
</tr>
</table>
<!-- -->
</center>
</form>
<table width="90%" border="0" cellspacing="0" cellpadding="4" style="text-align: center">
<tr style="vertical-align: top">
</tr>
</table></div>
<table width="53%" border="0" align="center" cellspacing="0" cellpadding="0" style="text-align: center">
<tr style="vertical-align: top">
<td width="20%" rowspan="2" class="StoryContentColor" style="vertical-align: top">
<div id="apDiv1"><img src="images/bach.gif" width="137" height="150" alt="bachelorette" /></div>
<p> </p>
<p> </p>
<p><br />
</p>
<tr style="vertical-align: top">
<td width="20%" rowspan="2" class="StoryContentColor" style="vertical-align: top">
<div id="apDiv3"><img src="images/money.gif" width="275" height="225" alt="make money" /></div>
<p><br />
</p>
</td>
<td width="20%"><div id="apDiv2"><img src="images/champ.gif" width="124" height="150" alt="champagne" /></div> <br /> </td>
</table>
<div id="apDiv5"><td class="NavigationColor"><h4 align="center"><a href="index.html">Home</a> </a> <a href="contact.html">Contact</a> <a href="about.html"> About</a> <a href="privacy.html">Privacy</a></h4></td></div>
</table> </td>
</tr>
</body>
</html>
Contact.php code
<?
$subject="from ".$_GET['your_name'];
$headers= "From: ".$_GET['your_email']."\n";
$headers.='Content-type: text/html; charset=iso-8859-1';
mail("sales@mydomain.com", $subject, "
<html>
<head>
<title>Contact letter</title>
</head>
<body>
<br>
".$_GET['message']."
</body>
</html>" , $headers);
echo ("Your message was successfully sent!");
?>
<script>
resizeTo(300, 300)
//window.close()
</script>
I have a contact.html page that asks users for name, e-mail and a message. once I click on submit I would like the page to call my contact.php page and send an e-mail to me with said information. I have listed the code below but I cant get it to work. any help would be much appreciated.
contact.html 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">
<head>
<title>My title</title>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<link href="flow.css" rel="stylesheet" type="text/css" />
<style type="text/css">
<!--
body,td,th {
color: #28042d;
}
#apDiv1 {
position:absolute;
width:188px;
height:113px;
z-index:1;
left: 38px;
top: 48px;
}
#apDiv2 {
position:absolute;
width:200px;
height:113px;
z-index:2;
left: 880px;
top: 48px;
}
#apDiv3 {
position:absolute;
width:200px;
height:115px;
z-index:3;
left: 414px;
top: 48px;
}
#apDiv4 {
position:absolute;
width:200px;
height:46px;
z-index:4;
left: 450px;
top: 0px;
}
#apDiv5 {
position:absolute;
width:200px;
height:40px;
z-index:5;
left: 450px;
top: 489px;
}
#apDiv6 {
position:absolute;
width:618px;
height:217px;
z-index:6;
left: 237px;
top: 284px;
}
-->
</style></head>
<body class="sub">
<div id="apDiv4"> <td class="NavigationColor"><h4 align="center"><a href="index.html">Home</a> </a> <a href="contact.html">Contact</a> <a href="about.html"> About</a> <a href="privacy.html">Privacy</a></h4></td></div>
<div id="apDiv6">
<form>
<form name="contact_form" action="contact.php" method="get">
<center>
<table width="567" height="175" border="0" cellpadding="0" cellspacing="0" bgcolor="#c1c2d9">
<tr> </tr>
<tr>
<td height="28" valign="top"><table width="456" border="0" cellspacing="0" cellpadding="0">
<tr>
<td width="124" align="right" class="text_1">Your name:</td>
<td width="26"><img src="images/spacer.gif" width="1" height="1" /></td>
<td><input name="your_name" type="text" class="form_1" /></td>
</tr>
</table></td>
</tr>
<tr>
<td height="28" valign="top"><table width="456" border="0" cellspacing="0" cellpadding="0">
<tr>
<td width="124" height="33" align="right" class="text_1">E-mail address:</td>
<td width="26"><img src="images/spacer.gif" width="1" height="1" /></td>
<td><input name="your_email" type="text" class="form_1" /></td>
</tr>
</table></td>
</tr>
<tr>
<td height="91" valign="top"><table width="469" border="0" cellspacing="0" cellpadding="0">
<tr>
<td width="124" align="right" valign="top" class="text_1" style="padding-top:3px ">Message:</td>
<td width="26"><img src="images/spacer.gif" width="1" height="1" /></td>
<td><textarea name="message" class="form_2"></textarea></td>
</tr>
</table></td>
</tr>
<tr>
<td valign="top"><input type="image" src="images/submit.gif" style="margin-left:29px;" onClick="submit();">
<input type="image" src="images/reset.gif" style="margin-left:338px " /></td>
</tr>
</table>
<!-- -->
</center>
</form>
<table width="90%" border="0" cellspacing="0" cellpadding="4" style="text-align: center">
<tr style="vertical-align: top">
</tr>
</table></div>
<table width="53%" border="0" align="center" cellspacing="0" cellpadding="0" style="text-align: center">
<tr style="vertical-align: top">
<td width="20%" rowspan="2" class="StoryContentColor" style="vertical-align: top">
<div id="apDiv1"><img src="images/bach.gif" width="137" height="150" alt="bachelorette" /></div>
<p> </p>
<p> </p>
<p><br />
</p>
<tr style="vertical-align: top">
<td width="20%" rowspan="2" class="StoryContentColor" style="vertical-align: top">
<div id="apDiv3"><img src="images/money.gif" width="275" height="225" alt="make money" /></div>
<p><br />
</p>
</td>
<td width="20%"><div id="apDiv2"><img src="images/champ.gif" width="124" height="150" alt="champagne" /></div> <br /> </td>
</table>
<div id="apDiv5"><td class="NavigationColor"><h4 align="center"><a href="index.html">Home</a> </a> <a href="contact.html">Contact</a> <a href="about.html"> About</a> <a href="privacy.html">Privacy</a></h4></td></div>
</table> </td>
</tr>
</body>
</html>
Contact.php code
<?
$subject="from ".$_GET['your_name'];
$headers= "From: ".$_GET['your_email']."\n";
$headers.='Content-type: text/html; charset=iso-8859-1';
mail("sales@mydomain.com", $subject, "
<html>
<head>
<title>Contact letter</title>
</head>
<body>
<br>
".$_GET['message']."
</body>
</html>" , $headers);
echo ("Your message was successfully sent!");
?>
<script>
resizeTo(300, 300)
//window.close()
</script>