I've been working with php for a short time and picked this form up online to use for my contact page. When tested on my server, [url]http://www.d1082919....h/contact2.html[/url] the text fields return all of the correct content (email, name, phone, etc.) to me in an email.
When I put the site live, http://vitalhabitats.com/contact2.html the text fields all return blank. I still receive the email, but it looks like this:
Email:
Name:
Phone Number:
Comments:
Newsletter:
I cannot understand what the potential issue may be. I know the form works, just not on this server.
Any help is greatly appreciated.
<?php
/* Subject and Email Variables */
$emailSubject = 'Inquiry';
$webMaster = 'example@example.com';
/*Gathering Data Variables */
$emailField = $_POST['email'];
$nameField = $_POST['name'];
$phoneField = $_POST['phone'];
$commentsField = $_POST['comments'];
$newsletterField = $_POST['newsletter'];
$body = <<<EOD
<br><hr><br>
Email: $email <br>
Name: $name <br>
Phone Number: $phone <br>
Comments: $comments <br>
Newsletter: $newsletter <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>Vital Habitats-Thank you</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<style type="text/css">
<!--
body {
font-family: Arial, Helvetica, sans-serif;
font-size: 14px;
font-style: normal;
line-height: normal;
font-weight: normal;
color: #666666;
text-decoration: none;
margin-top: 20px;
}
#result {
width: 600px;
margin-right: auto;
margin-left: auto;
background-color: #FFF;
padding: 5px;
border: 1px solid #435a33;
}
-->
</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 onLoad="MM_preloadImages('images/home_pgs_ovr.png')">
<div id="result">
<div align="center">
<p><img src="images/thankYouLogo.png" width="425" height="235"></p>
<p> </p>
<p>Thank you for your interest. Your email will be answered shortly.</p>
<div id="home"><a href="index.html" onMouseOut="MM_swapImgRestore()" onMouseOver="MM_swapImage('Home','','images/home_pgs_ovr.png',1)"><img src="images/home_pgs.png" alt="Home" name="Home" width="73" height="35" border="0"></a></div>
</div>
</div>
</body>
</html>
EOD;
echo "$theResults";
?>