stillkt1980 Posted September 3, 2009 Share Posted September 3, 2009 OK, guys... I wrote a very simple contact form script and it isn't working correctly. It sends me the email, but the requested info is missing. I'm new to scripting, so please be forgiving. If someone could possibly point out my error, what would be great! Thanks, guys! Here's the code: <?php /* Subject and Email Variables */ $emailSubject = 'Keep Me Updated!'; $webMaster = 'updates@byevolution.com'; /* Gathering Data Variables */ $emailField = $_POST['email']; $body = <<<EOD <br><hr><br> Email: $email <br> EOD; $headers = "From: $email\r\n"; $headers .= "Content-type: text/html\r\n"; $success = mail($webMaster, $emailSubject, $body, $headers,); /* Results Rendered as HTML */ $theResults = <<<EOD <html> <head> <title>success</title> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"> <link href="site_layout.css" rel="stylesheet" type="text/css"> <style type="text/css"> <!-- #apDiv1 { position:absolute; width:306px; height:38px; z-index:1; left: 479px; top: 419px; } --> </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)&&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.indexOf("#")!=0){ d.MM_p=new Image; d.MM_p[j++].src=a;}} } 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)&&d.all) x=d.all; for (i=0;!x&&i<d.forms.length;i++) x=d.forms; for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers.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))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];} } //--> </script> <link href="success_layout.css" rel="stylesheet" type="text/css"> </head> <body bgcolor="#FFFFFF" leftmargin="0" topmargin="0" marginwidth="0" marginheight="0" onLoad="MM_preloadImages('images/myspace.jpg','images/facebook.jpg','images/twitter.jpg')"> <!-- Save for Web Slices (success.psd) --> <div id="site_layout"> <table width="1200" height="601" border="0" align="center" cellpadding="0" cellspacing="0" id="Table_01"> <tr> <td colspan="10"> <img src="images/success_01.gif" width="1200" height="50" alt=""></td> </tr> <tr> <td colspan="10"> <img src="images/logo.jpg" width="1200" height="221" alt="Begin You Evolution"></td> </tr> <tr> <td colspan="10"> <img src="images/definition.gif" width="1200" height="92" alt=""></td> </tr> <tr> <td colspan="10"> <img src="images/bar.gif" width="1200" height="50" alt=""></td> </tr> <tr> <td colspan="10"> <img src="images/interest.gif" width="1200" height="67" alt=""></td> </tr> <tr> <td rowspan="3"> <img src="images/follow.gif" width="424" height="120" alt=""></td> <td colspan="2"> <img src="images/success_13.gif" width="27" height="80" alt=""></td> <td><a href="http://www.myspace.com/byevolution" onMouseOut="MM_swapImgRestore()" onMouseOver="MM_swapImage('myspacebtn','','images/myspace.jpg',1)"><img src="images/images/myspace.jpg" alt="Follow us on Myspace!" name="myspacebtn" width="73" height="80" border="0"></a></td> <td> <img src="images/success_15.gif" width="39" height="80" alt=""></td> <td><a href="http://www.facebook.com/home.php#/pages/BY-Evolution/112645499703?ref=ts" onMouseOut="MM_swapImgRestore()" onMouseOver="MM_swapImage('facebookbtn','','images/facebook.jpg',1)"><img src="images/images/facebook.jpg" alt="Follow us on Facebook!" name="facebookbtn" width="73" height="80" border="0"></a></td> <td> <img src="images/success_17.gif" width="39" height="80" alt=""></td> <td><a href="http://twitter.com/BYEvolution" onMouseOut="MM_swapImgRestore()" onMouseOver="MM_swapImage('twitterbtn','','images/twitter.jpg',1)"><img src="images/images/twitter_btn.jpg" alt="Follow us on Twitter!" name="twitterbtn" width="73" height="80" border="0"></a></td> <td> <img src="images/success_19.gif" width="56" height="80" alt=""></td> <td rowspan="3"> <img src="images/comingsoon_09.gif" width="396" height="120" alt=""></td> </tr> <tr> <td rowspan="2"> <img src="images/success_15-16.gif" width="1" height="40" alt=""></td> <td colspan="7"> <img src="images/copyright_success.jpg" width="379" height="39" alt=""></td> </tr> <tr> <td colspan="7"> <img src="images/success_17-18.gif" width="379" height="1" alt=""></td> </tr> <tr> <td> <img src="images/spacer.gif" width="424" height="1" alt=""></td> <td> <img src="images/spacer.gif" width="1" height="1" alt=""></td> <td> <img src="images/spacer.gif" width="26" height="1" alt=""></td> <td> <img src="images/spacer.gif" width="73" height="1" alt=""></td> <td> <img src="images/spacer.gif" width="39" height="1" alt=""></td> <td> <img src="images/spacer.gif" width="73" height="1" alt=""></td> <td> <img src="images/spacer.gif" width="39" height="1" alt=""></td> <td> <img src="images/spacer.gif" width="73" height="1" alt=""></td> <td> <img src="images/spacer.gif" width="56" height="1" alt=""></td> <td> <img src="images/spacer.gif" width="396" height="1" alt=""></td> </tr> </table> </div> <!-- End Save for Web Slices --> </body> </html> EOD; echo "$theResults"; ?> [attachment deleted by admin] Quote Link to comment https://forums.phpfreaks.com/topic/172918-solved-php-help-please-i-must-be-an-idiot/ Share on other sites More sharing options...
Garethp Posted September 3, 2009 Share Posted September 3, 2009 $body = <<<EOD <br><hr><br> Email: $email <br> EOD; Where are your quotes? Try this, then tell us how it works $body = "<<<EOD <br><hr><br> Email: $email <br> EOD"; Quote Link to comment https://forums.phpfreaks.com/topic/172918-solved-php-help-please-i-must-be-an-idiot/#findComment-911370 Share on other sites More sharing options...
Garethp Posted September 3, 2009 Share Posted September 3, 2009 Also, $theresults don't seem to be quoted either. You have errors off, right? You should turn them on Quote Link to comment https://forums.phpfreaks.com/topic/172918-solved-php-help-please-i-must-be-an-idiot/#findComment-911373 Share on other sites More sharing options...
stillkt1980 Posted September 3, 2009 Author Share Posted September 3, 2009 Thanks for your help! I entered the quotes as you said, and all I received in the email was: Email: EOD Quote Link to comment https://forums.phpfreaks.com/topic/172918-solved-php-help-please-i-must-be-an-idiot/#findComment-911379 Share on other sites More sharing options...
stillkt1980 Posted September 3, 2009 Author Share Posted September 3, 2009 I also forgot to add that the results page shows up just fine, even without the quotes. Quote Link to comment https://forums.phpfreaks.com/topic/172918-solved-php-help-please-i-must-be-an-idiot/#findComment-911380 Share on other sites More sharing options...
Garethp Posted September 3, 2009 Share Posted September 3, 2009 Have you assigned $email to any value? Quote Link to comment https://forums.phpfreaks.com/topic/172918-solved-php-help-please-i-must-be-an-idiot/#findComment-911384 Share on other sites More sharing options...
stillkt1980 Posted September 3, 2009 Author Share Posted September 3, 2009 Yes, email is assigned to the contact form which only consists of one text box and a submit button. Here's the website if you want to look at it. http://byevolution.com Thanks! Quote Link to comment https://forums.phpfreaks.com/topic/172918-solved-php-help-please-i-must-be-an-idiot/#findComment-911386 Share on other sites More sharing options...
Garethp Posted September 3, 2009 Share Posted September 3, 2009 Look here $emailField = $_POST['email']; $body = <<<EOD <br><hr><br> Email: $email <br> EOD; You have $emailField set, but nowhere did you set $email. Try this $emailField = $_POST['email']; $body = <<<EOD <br><hr><br> Email: $emailField <br> EOD; Quote Link to comment https://forums.phpfreaks.com/topic/172918-solved-php-help-please-i-must-be-an-idiot/#findComment-911389 Share on other sites More sharing options...
stillkt1980 Posted September 3, 2009 Author Share Posted September 3, 2009 THANK YOU! I'm so lame. I knew it had to be an easy fix and I probably wouldn't have ever caught it. I'd so buy you chocolate! Quote Link to comment https://forums.phpfreaks.com/topic/172918-solved-php-help-please-i-must-be-an-idiot/#findComment-911391 Share on other sites More sharing options...
Garethp Posted September 3, 2009 Share Posted September 3, 2009 Hahah, email me the chocolate, I'm sure Gmail will accept it as an attachment XD Quote Link to comment https://forums.phpfreaks.com/topic/172918-solved-php-help-please-i-must-be-an-idiot/#findComment-911393 Share on other sites More sharing options...
shadowfiend20 Posted September 3, 2009 Share Posted September 3, 2009 The website looks neat man..keep it up..4/5gold stars:D Quote Link to comment https://forums.phpfreaks.com/topic/172918-solved-php-help-please-i-must-be-an-idiot/#findComment-911531 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.