Hey! I created a simple contact form for my site which is sending emails to my specified email address OK. The confirmation message to show that the persons message has been submitted also shows up OK. But when I receive the emails there is no sender email address, which is just blank. The actual details in the email are blank (i.e. it only shows "Name:" , "Email Address:" , "Phone Number:" and "Message:" but the actual details are not being picked up. :bemused:
I was wondering if you could have a skim through my code to see if I have made any mistakes? Thanks
HTML Code:
<form id="form1" name="form1" method="post" action="contactformportfolio.php">
<p align="left">
<label for="name">*Name<br />
</label>
<input type="text" name="name" id="Name" />
</p>
<p align="left">
<label for="email">*Email Address</label>
<br />
<input type="text" name="email" id="Email" />
</p>
<p align="left">
<label for="phone_number">Phone Number<br />
</label>
<input type="text" name="phone_number" id="PhoneNumber" />
</p>
<p align="left">
<label for="message">*Message<br />
</label>
<textarea name="message" id="Message" cols="45" rows="5"></textarea>
</p>
<p align="left">
<input name="submit" type="submit" id="submit" onclick="MM_validateForm('Name','','R','Email','','RisEmail','PhoneNumber','','NisNum','Message','','R');return document.MM_returnValue" value="Submit" />
<input type="reset" name="clear_form" id="clear_form" value="Clear Form" />
</p>
</form>
<p> </p>
<p> </p>
</div>
PHP Code:
<?php
/* Email Variables */
$emailSubject ='contactformportfolio';
$webMaster ='example@example.com';
/* Data Variables */
$name = $_POST['Name'];
$Email = $_POST['Email'];
$PhoneNumber = $_POST['PhoneNumber'];
$Message = $_POST['Message'];
$body = <<<EOD
<br><hr><br>
Name: $Name<br>
Email: $Email<br>
Phone Number: $PhoneNumber<br>
Message: $Message<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://aoifeboyle.com/Contact.html">
<style type="text/css">
<!--
body {
background-color: #B2B2B2;
font-family: Verdana, Arial, Helvetica, sans-serif;
font-size: 20px;
font-style: normal;
line-height: normal;
font-weight: normal;
color: #212121;
text-decoration: none;
padding-top: 200px;
margin-left: 150px;
width: 800px;
}
-->
</style>
</head>
<div align="center">Thank you! Your message has been successfully submitted and will be replied to within 24 hours! You will be redirected back to the contact page shortly!</div>
</body>
</html>
EOD;
echo "$theResults";
?>
Untitled-2 copy.jpg