PDA

View Full Version : PHP blank e-mails


polanski11
04-18-2011, 12:36 PM
Hi all,

I'm having problems with a php script I've modifoed from an online template which forwards e-mails to my e-mail address from the contact page on my website.

The php script forwards the e-mails but the fields are blank.Can someone please help?


html form source code inside .div tag from my webpage:

<div id="content_right" onfocus="MM_validateForm('email','','RisEmail','name','','R ','request','','R');MM_validateForm('name','','R') ;return document.MM_returnValue">
<form action="contactformprocess.php" method="get" onsubmit="MM_validateForm('email','','RisEmail');return document.MM_returnValue">
<table width="100%" border="0" cellpadding="6">
<tr>
<td width="21%" height="33" align="left"><label for="email"><span class="style7">E-mail:</span></label></td>
<td width="79%"><input name="email" type="text" id="email" value="" size="37" maxlength="35" /></td>
</tr>
<tr>
<td align="left"><label for="name"><span class="style7">Name:</span></label></td>
<td><input name="name" type="text" id="name" value="" size="37" maxlength="35" /></td>
</tr>
<tr>
<td align="left"><label for="phone"><span class="style7">Phone No:</span></label></td>
<td><input name="phone" type="text" id="phone" value="" size="37" maxlength="35" /></td>
</tr>
<tr>
<td align="left"><label for="request"><span class="style7">Request</span></label>
:</td>
<td><textarea name="request" id="request" cols="27" rows="12"></textarea></td>
</tr>

<tr>
<td align="left"><label for="clear"></label>
<input type="reset" name="clear" id="clear" value="Reset Form!" /></td>
<td align="center"><label for="submit"></label>
<input type="submit" name="submit" id="submit" value="Send E-mail" /></td>
</tr>
</table>
</form>

Php script:

<?php
/* Email Variables */
$emailSubject = 'contactformprocess!';
$webMaster = 'ghanstock@hotmail.com';

/* Data Variables */
$email = $_POST['email'];
$name = $_POST['name'];
$phone = $_POST['phone'];
$request = $_POST['request'];

$body = <<<EOD
<br><hr><br>
Email: $email <br>
Name: $name <br>
Phone: $phone <br>
Request: $request <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>sent message</title>
<meta http-equiv="refresh" content="3;URL=http://file:///Volumes/LaCie/ebp_16.02.10_02/homepage.html">
<style type="text/css">
<!--
body {
background-color: #444;
font-family: Verdana, Arial, Helvetica, sans-serif;
font-size: 20px;
font-style: normal;
line-height: normal;
font-weight: normal;
color: #fec001;
text-decoration: none;
padding-top: 200px;
margin-left: 150px;
width: 800px;
}
-->
</style>
</head>
<div align="center">Your email will be answered soon as possible!
You will be returned to Electrobank Media in a few seconds !</div>
</div>
</body>
</html>
EOD;
echo "$theResults";
?>

davidj
04-18-2011, 02:01 PM
your form method is set to GET but you are catching POSTS

Change your form method to POST