...

View Full Version : PHP form some part email showing blank



newtocode
10-11-2009, 07:34 AM
I can figure this out why email some form values are not showing up why not everything look right.

This is the way my email look when I get them the names are not showing.

Northern Region Freight Contact US
...
From:
Nobody
...
Add to Contacts
To: usatrucker20076@yahoo.com


First name:
Last name:
Email: gamer2456@live.com
Support type: Question
Other:
Comments: how the everthing.


<!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>Northern Region Freight Contact US</title>
<style type="text/css">
<!--
body {
background-color: #386643;
background-image: url(images/bg1.gif);
background-repeat: repeat-x;
}
-->
</style>
<link href="css/layout.css" rel="stylesheet" type="text/css" />
</head>

<body>
<div id="wrapper">
<div id="logo"><img src="images/NRFlogo.jpg" alt="NRFlogo" width="980" height="200" /></div>
<div id="navigation"></div>
<div id="bodyArea">
<div id="content"> <p align="center">&nbsp;</p>
<form action="contactformprocess.php" method="post" name="form1" id="form1">
<p align="left"><strong> FirstName * </strong> </p>
<p align="left">
<input name="firstname" type="text" id="firstname" size="35" />
</p>
<p align="left">&nbsp;</p>
<p align="left"><strong>Last Name* </strong></p>
<p align="left">
<input name="lastname" type="text" id="lastname" size="35" />
</p>
<p align="left">&nbsp;</p>
<p align="left"><strong>Email *</strong></p>
<p align="left">
<input name="email" type="text" id="email" size="35" />
</p>
<p align="left">&nbsp;</p>
<p align="left"><strong>Please Select Type of Support From list below</strong></p>
<p align="left">
<select name="supporttype" id="supporttype">
<option selected="selected">Select one</option>
<option value="Question">Question</option>
<option value="Technical Support">Technical Support</option>
<option value="Other">Other</option>
</select>
</p>
<p align="left">&nbsp;</p>
<p align="left"><strong>IF other please type it below</strong></p>
<p align="left">
<input name="other" type="text" id="other" size="35" />
</p>
<p align="left">&nbsp;</p>
<p align="left">
<textarea name="comments" id="comments" cols="45" rows="5"></textarea>
</p>
<p align="left">&nbsp;</p>
<p align="left">
<input type="submit" name="submit" id="submit" value="Submit" />
<input type="reset" name="reset" id="reset" value="Reset" />
</p>
<p>&nbsp;</p>
</form>

<p>&nbsp;</p>
</div>
<div id="footer"></div>
</div>
</div>
</body>
</html>



<?php
/* Subject and Email Veriables */

$emailSubject = "Northern Region Freight Contact US";
$webMaster = "usatrucker20076@yahoo.com";

/* Gathering Data Veriables */

$firstnameField = $_POST['first name'];
$lastnameField = $_POST['last name'];
$emailField = $_POST['email'];
$supporttypeField = $_POST['support type'];
$otherField = $_POST['other'];
$commentsField = $_POST['comments'];

$body = "";
$body .= "<br>";
$body .= "<hr>";
$body .= "<br>";
$body .= "Firstname: " . $_POST['first name'] . "<br>\n";
$body .= "Lastname: " . $_POST['last name'] . "<br>\n";
$body .= "Email: " . $_POST['email'] . "<br>\n";
$body .= "Supporttype: " . $_POST['support type'] . "<br>\n";
$body .= "Other: " . $_POST['other'] . "<br>\n";
$body .= "Comments: " . $_POST['comments'] . "<br>\n";

$headers = "From: $email\r\n";
$headers .= "Content-type: text/html\r\n";
$success = mail("$webMaster", "$emailSubject", "$body", "$headers");

/* Results rendered as HTML */

$theResults = <<<EOD2
<!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>Northern Region Freight </title>
<style type="text/css">
<!--
body {
background-color: #386643;
background-image: url(images/bg1.gif);
background-repeat: repeat-x;
}
-->
</style>
<link href="css/layout.css" rel="stylesheet" type="text/css" />
</head>

<body>
<div id="wrapper">
<div id="logo"><img src="images/NRFlogo.jpg" alt="NRFlogo" width="980" height="200" /></div>
<div id="navigation"></div>
<div id="bodyArea">
<div id="content">
<p align="center">&nbsp;</p>
<p align="center">&nbsp;</p>
<p align="center">&nbsp;</p>
<p align="center">&nbsp;</p>
<p align="center">Thank you For your interest in Northern Region Freight we will </p>
<p align="center">get back to you with 24 hours of submission.</p>
<p align="center">&nbsp;</p>
<p align="center">&nbsp;</p>
<p align="center">&nbsp;</p>
<p align="center">&nbsp;</p>
<p align="center">&nbsp;</p>
<p align="center">&nbsp;</p>
<p align="center">&nbsp;</p>
<p align="center">&nbsp;</p>
<p align="center">&nbsp;</p>
<p align="center">&nbsp;</p>
<p align="center">&nbsp;</p>
<p align="center">&nbsp;</p>
<p align="center">&nbsp;</p>
<p align="center">&nbsp;</p>
<p align="center">&nbsp;</p>
<p align="center">&nbsp;</p>
<p align="center">&nbsp;</p>
<p align="center"><br />
</p>
<p align="center">&nbsp;</p>
<p align="center">&nbsp;</p>
</div>
<div id="footer"></div>
</div>
</div>
</body>
</html>

EOD2;

echo $theResults;

?>

abduraooft
10-11-2009, 01:30 PM
<input name="firstname" type="text" id="firstname" size="35" />

$firstnameField = $_POST['first name'];
$lastnameField = $_POST['last name'];
Isn't that obvious? I'd recommend to use a strict error reporting and turn on the reporting while development.

met
10-11-2009, 02:21 PM
see http://www.codingforums.com/showthread.php?t=179316

works.

new thread not really needed



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum