newtocode
10-10-2009, 06:04 PM
Form Problem with php get this error code when space words also when don't my space them some thing are not showing.
How can space them and get each area to show in the email
Here the part that are not showing in email
Firstname:
Lastname:
Email: myemail@live.com
Supporttype:
Other:
Comments: hi
here the code I get when space names and support type
Parse error: syntax error, unexpected T_STRING in /home/a9375737/public_html/contactformprocess.php on line 9
HTML Code
<!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"> </p>
<form action="contactformprocess.php" method="post" name="form1" id="form1">
<p align="left"><strong> FirstName * </strong> </p>
<p align="left">
<input name="first name" type="text" id="first name" size="35" />
</p>
<p align="left"> </p>
<p align="left"><strong>Last Name* </strong></p>
<p align="left">
<input name="last name" type="text" id="last name" size="35" />
</p>
<p align="left"> </p>
<p align="left"><strong>Email *</strong></p>
<p align="left">
<input name="email" type="text" id="email" size="35" />
</p>
<p align="left"> </p>
<p align="left"><strong>Please Select Type of Support From list below</strong></p>
<p align="left">
<select name="support type" id="support type">
<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"> </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"> </p>
<p align="left">
<textarea name="comments" id="comments" cols="45" rows="5"></textarea>
</p>
<p align="left"> </p>
<p align="left">
<input type="submit" name="submit" id="submit" value="Submit" />
<input type="reset" name="reset" id="reset" value="Reset" />
</p>
<p> </p>
</form>
<p> </p>
</div>
<div id="footer"></div>
</div>
</div>
</body>
</html>
PHP code
<?php
/* Subject and Email Veriables */
$emailSubject = "Northern Region Freight Contact US";
$webMaster = "usatrucker20076@yahoo.com";
/* Gathering Data Veriables */
$first nameField = $_POST['first name'];
$last nameField = $_POST['last name'];
$emailField = $_POST['email'];
$support typeField = $_POST['support type'];
$otherField = $_POST['other'];
$commentsField = $_POST['comments'];
$body = "";
$body .= "<br>";
$body .= "<hr>";
$body .= "<br>";
$body .= "First name: " . $_POST['first name'] . "<br>\n";
$body .= "Last name: " . $_POST['last name'] . "<br>\n";
$body .= "Email: " . $_POST['email'] . "<br>\n";
$body .= "Support type: " . $_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"> </p>
<p align="center"> </p>
<p align="center"> </p>
<p align="center"> </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"> </p>
<p align="center"> </p>
<p align="center"> </p>
<p align="center"> </p>
<p align="center"> </p>
<p align="center"> </p>
<p align="center"> </p>
<p align="center"> </p>
<p align="center"> </p>
<p align="center"> </p>
<p align="center"> </p>
<p align="center"> </p>
<p align="center"> </p>
<p align="center"> </p>
<p align="center"> </p>
<p align="center"> </p>
<p align="center"> </p>
<p align="center"><br />
</p>
<p align="center"> </p>
<p align="center"> </p>
</div>
<div id="footer"></div>
</div>
</div>
</body>
</html>
EOD2;
echo $theResults;
?>
How can space them and get each area to show in the email
Here the part that are not showing in email
Firstname:
Lastname:
Email: myemail@live.com
Supporttype:
Other:
Comments: hi
here the code I get when space names and support type
Parse error: syntax error, unexpected T_STRING in /home/a9375737/public_html/contactformprocess.php on line 9
HTML Code
<!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"> </p>
<form action="contactformprocess.php" method="post" name="form1" id="form1">
<p align="left"><strong> FirstName * </strong> </p>
<p align="left">
<input name="first name" type="text" id="first name" size="35" />
</p>
<p align="left"> </p>
<p align="left"><strong>Last Name* </strong></p>
<p align="left">
<input name="last name" type="text" id="last name" size="35" />
</p>
<p align="left"> </p>
<p align="left"><strong>Email *</strong></p>
<p align="left">
<input name="email" type="text" id="email" size="35" />
</p>
<p align="left"> </p>
<p align="left"><strong>Please Select Type of Support From list below</strong></p>
<p align="left">
<select name="support type" id="support type">
<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"> </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"> </p>
<p align="left">
<textarea name="comments" id="comments" cols="45" rows="5"></textarea>
</p>
<p align="left"> </p>
<p align="left">
<input type="submit" name="submit" id="submit" value="Submit" />
<input type="reset" name="reset" id="reset" value="Reset" />
</p>
<p> </p>
</form>
<p> </p>
</div>
<div id="footer"></div>
</div>
</div>
</body>
</html>
PHP code
<?php
/* Subject and Email Veriables */
$emailSubject = "Northern Region Freight Contact US";
$webMaster = "usatrucker20076@yahoo.com";
/* Gathering Data Veriables */
$first nameField = $_POST['first name'];
$last nameField = $_POST['last name'];
$emailField = $_POST['email'];
$support typeField = $_POST['support type'];
$otherField = $_POST['other'];
$commentsField = $_POST['comments'];
$body = "";
$body .= "<br>";
$body .= "<hr>";
$body .= "<br>";
$body .= "First name: " . $_POST['first name'] . "<br>\n";
$body .= "Last name: " . $_POST['last name'] . "<br>\n";
$body .= "Email: " . $_POST['email'] . "<br>\n";
$body .= "Support type: " . $_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"> </p>
<p align="center"> </p>
<p align="center"> </p>
<p align="center"> </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"> </p>
<p align="center"> </p>
<p align="center"> </p>
<p align="center"> </p>
<p align="center"> </p>
<p align="center"> </p>
<p align="center"> </p>
<p align="center"> </p>
<p align="center"> </p>
<p align="center"> </p>
<p align="center"> </p>
<p align="center"> </p>
<p align="center"> </p>
<p align="center"> </p>
<p align="center"> </p>
<p align="center"> </p>
<p align="center"> </p>
<p align="center"><br />
</p>
<p align="center"> </p>
<p align="center"> </p>
</div>
<div id="footer"></div>
</div>
</div>
</body>
</html>
EOD2;
echo $theResults;
?>