From what I can gather on the internet this is a fairly easy piece of PHP script but success is eluding me. Maybe im missing something really small like punctuation or an uppercase letter or maybe its something else. Im wondering would it be possible that theres conflict between java and PHP also contained on the page. The java script is part of my webpage and is set in between EOD tags. Take a look for yourself but for the life of me I just cant get it to work right. Any help on this would be greatly appreciated.

<?php
/* subject and email vars */
	$emailSubject = 'someone commented on infront-design.com';
	$toAddress = 'info@infront-design.com';
/* data colletction vars */
	$nameField = $_POST ['Name'];
	$mailField = $_POST ['email'];
	$commentsField = $_POST ['Comments'];
	
	$body = <<<EOD
<br><hr><br>
Name: $Name <br>
Email: $email <br>
message: $Comments <br>
EOD;

	$headers = "From: $email\r\n";
	$headers .= "Content-type: text/html\r\n";
	$success = mail ($emailSubject, $toAddress, $body, $headers);
/* code change to html display upon form submission */
	
	$formSuccess = <<<EOD
<!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>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Infront-Design.com, media design services by Vincent Furlong</title>
<meta name="description" content="All in one media design services" />
<meta name="keywords" content="Irish media design,Web design service,flash design services,All in one web design,Audio production,irish web designer,dublin web designer,psd websites,flash animation,banners,logos,Audio services" />
<style type="text/css">
<!--
body {
	margin-top: 0px;
	margin-bottom: 0px;
	background-color: #01040C;
}
body,td,th {
	font-family: Arial;
	font-size: 12px;
	color: #FFF;
}
.size14 {
	font-size: 18px;
	font-style: italic;
}
.dsa {
	font-family: Tahoma, Geneva, sans-serif;
	font-size: 14px;
}
.dsa {
}
a {
	font-size: 12px;
	color: #FFF;
	font-weight: bold;
}
a:link {
	text-decoration: none;
}
a:visited {
	text-decoration: none;
	color: #FFF;
}
a:hover {
	text-decoration: none;
	color: #CCC;
}
a:active {
	text-decoration: underline;
	color: #FFF;
	font-size: smaller;
}
.key {
	font-weight: bold;
}
.size141 {	font-size: 14px;
}
.highlight {
	color: #FFF;
}
Bdr {
	border-bottom-style: dotted;
	border-top-style: dotted;
	border-right-style: inset;
	border-left-style: inset;
}
.cell {
	border-top-style: none;
	border-right-style: none;
	border-bottom-style: none;
	border-left-style: none;
	border-top-width: 0px;
	border-right-width: 0px;
	border-bottom-width: 0px;
	border-left-width: 0px;
}
-->
</style>
<script type="text/javascript">
<!--
function MM_swapImgRestore() { //v3.0
  var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}
function MM_preloadImages() { //v3.0
  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
    var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
    if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}
function MM_findObj(n, d) { //v4.01
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  if(!x && d.getElementById) x=d.getElementById(n); return x;
}
function MM_swapImage() { //v3.0
  var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
   if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}
//-->
</script>
</head>
<body text="#FFFFFF" topmargin="0" marginwidth="0"onload="MM_preloadImages('images/btns/Web Design over.jpg','images/btns/Audio Production over.jpg','images/btns/Flash Design over.jpg','images/btns/Photoshop Design Over.jpg','images/btns/Hire Designer over.jpg')">
<table width="100%" border="0" cellspacing="0" cellpadding="0">
  <tr valign="top">
    <td height="828" align="center"><table width="899" border="0" cellspacing="0" cellpadding="0" background="infront-design bg.jpg">
      <tr>
        <td width="899" height="828" align="center" valign="top"><table width="893" height="700" border="0" cellpadding="0" cellspacing="0">
          <tr>
            <td width="338" height="345" align="left" valign="top"><img src="images/btns/infront-design home.jpg" alt="homepage" width="258" height="70" border="0" usemap="#Map" /></td>
            <td width="555" align="left" valign="top"><br />
              <table width="507" border="0" cellspacing="0" cellpadding="4">
              <tr>
                  <td width="100" height="43"><a href="web design.html" onmouseout="MM_swapImgRestore()" onmouseover="MM_swapImage('Web Design','','images/btns/Web Design over.jpg',1)"><img src="images/btns/Web Design over.jpg" alt="web design" width="100" height="30" border="0" /></a><a href="web.html" onmouseout="MM_swapImgRestore()" onmouseover="MM_swapImage('web','','images/btns/web over.jpg',1)"></a></td>
                  <td width="100"><a href="audio production.html" onmouseout="MM_swapImgRestore()" onmouseover="MM_swapImage('Audio Production','','images/btns/Audio Production over.jpg',1)"><img src="images/btns/Audio Production up.jpg" alt="Audio Production" name="Audio Production" width="100" height="30" border="0" id="Audio Production" /></a><a href="#" onmouseout="MM_swapImgRestore()" onmouseover="MM_swapImage('Audio','','images/btns/audio over.jpg',1)"></a></td>
                  <td width="100"><a href="flash design.html" onmouseout="MM_swapImgRestore()" onmouseover="MM_swapImage('Flash Design','','images/btns/Flash Design over.jpg',1)"><img src="images/btns/Flash Design up.jpg" alt="Flash Design" name="Flash Design" width="100" height="30" border="0" id="Flash Design" /></a><a href="#" onmouseout="MM_swapImgRestore()" onmouseover="MM_swapImage('Flash','','images/btns/flash over.jpg',1)"></a></td>
                  <td width="100"><a href="photoshop design.html" onmouseout="MM_swapImgRestore()" onmouseover="MM_swapImage('Photoshop Design','','images/btns/Photoshop Design Over.jpg',1)"><img src="images/btns/Photoshop Design up.jpg" alt="Photoshop Design" name="Photoshop Design" width="100" height="30" border="0" id="Photoshop Design" /></a><a href="#" onmouseout="MM_swapImgRestore()" onmouseover="MM_swapImage('Templates','','images/btns/temp over.jpg',1)"></a></td>
                  <td width="44"><a href="hire designer.html" onmouseout="MM_swapImgRestore()" onmouseover="MM_swapImage('Hire A Designer','','images/btns/Hire Designer over.jpg',1)"><img src="images/btns/Hire designer up.jpg" alt="Contact To Hire Services" name="Hire A Designer" width="100" height="30" border="0" id="Hire A Designer" /></a><a href="#" onmouseout="MM_swapImgRestore()" onmouseover="MM_swapImage('contact','','images/btns/contact over.jpg',1)"></a></td>
                </tr>
              </table>
              <div align="right"></div>
              <p>&nbsp;</p></td>
          </tr><br />
          <tr>
            <td height="355" align="left" valign="top"><table width="231" border="0" cellspacing="0" cellpadding="0">
              <tr>
                <td width="231" align="center" valign="top"><table width="234" border="1" cellpadding="2" cellspacing="0" bordercolor="#4B4845" class="cell">
                  <tr>
                    <td width="224" align="center" valign="middle" bgcolor="#000A48" class="quickjump"> SERVICES &amp; INFORMATION</td>
                  </tr>
                  <tr class="cell">
                    <td height="30" align="left" valign="middle" bgcolor="#000111"><a href="web design.html">Web design </a></td>
                  </tr>
                  <tr>
                    <td height="30" align="left" valign="middle" bgcolor="#000111"><a href="S.E.O Designer.html">Design for S.E.O</a></td>
                  </tr>
                  <tr>
                    <td height="30" align="left" valign="middle" bgcolor="#000111"><a href="photoshop design.html">Photoshop templates</a></td>
                  </tr>
                  <tr>
                    <td height="30" align="left" valign="middle" bgcolor="#000111"><a href="flash design.html" title="flash design">Flash Templates</a><a href="index.html"></a></td>
                  </tr>
                  <tr>
                    <td height="30" align="left" valign="middle" bgcolor="#000111"><a href="Flash banner design.html">Flash Banners</a></td>
                  </tr>
                  <tr>
                    <td height="30" align="left" valign="middle" bgcolor="#000111"><a href="Logo design.html">Logo Design</a><a href="photoshop design.html"></a></td>
                  </tr>
                  <tr>
                    <td height="30" align="left" valign="middle" bgcolor="#000111"><a href="audio production.html">Audio production</a><a href="audio.html" title="audio production"></a></td>
                  </tr>
                  <tr>
                    <td height="30" align="left" valign="middle" bgcolor="#000111"><a href="Audio Services.html">Audio Cleaning Services</a><a href="hire designer.html"></a><a href="index.html"></a></td>
                  </tr>
                  <tr>
                    <td height="30" align="left" valign="middle" bgcolor="#000111"><a href="index.html">Home</a><a href="hire designer.html"></a></td>
                  </tr>
                  <tr>
                    <td height="30" align="left" valign="middle" bgcolor="#000111"><a href="hire designer.html">Contact</a></td>
                  </tr>
                  <tr>
                    <td height="30" align="left" valign="middle" bgcolor="#000111"><a href="about.html">About</a></td>
                  </tr>
                </table>
                  <div align="center"></div></td>
              </tr>
            </table></td>
            <td align="left" valign="top"><h2 class="dsa"><strong>Thanks for your email</strong><br />
                <br />
I will get back to you as soon as possible!</h2>
              <br />
              <br />
              <br /></td>
          </tr>
        </table>
          <p><br />
          </p>
          <br />
          <br />
          <br />
          <table width="637" border="0" cellspacing="0" cellpadding="0">
            <tr>
              <td width="59" height="15"><div align="center"><a href="index.html" title="home">Home+</a></div></td>
              <td width="73"><div align="center"><a href="hire designer.html" title="contact">Contact+</a></div></td>
              <td width="102"><div align="center"><a href="web design.html" title="web">Web Design+</a></div></td>
              <td width="132"><div align="center"><a href="photoshop design.html" title="photo">Photoshop design+</a></div></td>
              <td width="120"><div align="center"><a href="Audio production.html" title="audio">Audio production+</a></div></td>
              <td width="101" align="left"><div align="center"><a href="flash design.html" title="flash">Flash design+</a></div></td>
              <td width="50"><div align="center"><a href="services.html" title="services">About+</a></div></td>
              </tr>
          </table>
          copyright 2009+ Website Designed by Infront-design.com</td>
      </tr>
    </table></td>
  </tr>
</table>
<map name="Map" id="Map">
  <area shape="rect" coords="2,1,257,68" href="index.html" alt="home page" />
</map>
<map name="Map2" id="Map2">
  <area shape="rect" coords="-2,-2,140,105" href="http://www.coastmtcounselling.com" alt="coastmountaincounselling.com" />
</map>
<map name="Map3" id="Map3">
  <area shape="rect" coords="1,1,139,99" href="natura.html" alt="Natura Trim" />
</map>
<map name="Map4" id="Map4">
  <area shape="rect" coords="1,1,138,99" href="http://www.soulfinderonline.tk" alt="soulfinderonline.tk" />
</map>
</body>
</html>
EOD;
echo "$formSuccess";

?>

Thanks for the help in advance and to everyone who replied to my last thread. Although it was a pretty amateur topic, your replies helped out a lot!

Recommended Answers

All 4 Replies

Well its not outputting properly, All the PHP after the EOD tags are being displayed on the web page, which makes me think that I typed or mistyped something, and also im not getting any mail when I hit the submit button. I tried to attatch a screen shot but I dont know how to do it. the attatchment button isnt working for some reason:'(

Did you see the out put in this ??
I have found one php tag is not closed their
<?php
/* subject and email vars */
$emailSubject = 'someone commented on infront-design.com';
$toAddress = 'info@infront-design.com';
/* data colletction vars */
$nameField = $_POST ;
$mailField = $_POST ;
$commentsField = $_POST ;

$body = <<<EOD
<br><hr><br>
Name: $Name <br>
Email: $email <br>
message: $Comments <br>
EOD;

$headers = "From: $email\r\n";
$headers .= "Content-type: text/html\r\n";
$success = mail ($emailSubject, $toAddress, $body, $headers);
/* code change to html display upon form submission */

$formSuccess = <<<EOD

?>
Use a close tag anywhere you need. And now check again

hey where is your form and how did you retrieve $POST data //

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.