Jump to content

TOTAL PHP NEWBIE - Parse error: syntax error, unexpected T_STRING


ebryant77

Recommended Posts

I am TOTALLY NEW to php, and blindly trying to figure this out. (When I say new I mean NEW so if you reply please keep in mind that I KNOW ALMOST NOTHING haha). I need to get this entry form posted asap, but I am lost. I copied the code from another (working) online info request form, but this one does not work. I get the error:

 

Parse error: syntax error, unexpected T_STRING in /u/vp/cleanairlawncare.com/www/opp2010.php on line 110

 

I have been over the code so many times I am going crazy. Any help would be greatly appreciated!!

 

Here is the code (also attached):

<?php
// Field Mapping
$sName = $_POST["txtName"];
$scity = $_POST["txtCity"];
$sState = $_POST["selState"];
$sEmailAddress = $_POST["txtEmailAddress"];
$sZipCode = $_POST["txtZip"];
$sPhoneNumber = $_POST["txtPhoneNumber"];
$sSubject = $_POST["selSubject"];
$sHear = $_POST["txtHear"];
$sComments = $_POST["txtComments"];


if (($sName == "") || ($sEmailAddress == "") || ($scity == "") || ($sState == "") || ($sPhoneNumber == "") || ($sHear == ""))
{
print('<span style="color:#ffffff; font-size:14px; font-family:Arial, Helvetica, sans-serif">Please complete the Form. <a style="color:#ffffff" href="contact.html" onClick="history.go(-1);">Click here to go back</a></span>');
}
else
{
$sMailFrom = '[email protected]';

$sMailTo = '[email protected]';
$sMailSubject = 'Clean Air Lawn Care Website form';

$sMailBody = '<p>Clean Air Lawn Care - Franchise/Contact Form</p>
Name: <b>' . $sName . '</b><br />
City: <b>' . $scity . '</b><br />
State: <b>' . $sState . '</b><br />
Email Address: <b>' . $sEmailAddress . '</b><br />
Zip Code: <b>' . $sZipCode . '</b><br />
Phone Number: <b>' . $sPhoneNumber . '</b><br />
Subject: <b>' . $sSubject . '</b><br />
How did you hear about us: <b>' . $sHear . '</b><br />
Comments: <b>' . $sComments . '</b><br />';

$sMailHeaders = "From: $sMailFrom\n";
$sMailHeaders .= "Content-Type: text/html; charset=iso-8859-1\r\n";

if (mail($sMailTo, $sMailSubject, $sMailBody, $sMailHeaders))
{
	print('<span style="color:#CCFFFF; font-size:14px; font-family:Arial, Helvetica, sans-serif"><div align="center"><br /><br />Thank you, your information has been emailed!</div></span>');
}
else
{
	print('<span style="color:#CCFFFF; font-size:14px; font-family:Arial, Helvetica, sans-serif"><div align="center"><br /><br />Could not send e-mail, please contact the webmaster!</div></span>');
}
}
?>

 

[attachment deleted by admin]

Thanks Felex,

 

I tried that, but now I get THIS error

Parse error: syntax error, unexpected T_VARIABLE in /u/vp/cleanairlawncare.com/www/opp2010.php on line 105

 

Code now reads:

<?php
// Field Mapping
$sFirstName = $_POST["txtFirstName"];
$sLastName = $_POST["txtLastName"];
$sEmailAddress = $_POST["txtEmailAddress"];
$sPhoneNumber = $_POST["txtPhoneNumber"];
$sCity = $_POST["txtCity"];
$sState = $_POST["selState"];
$sOwnCity = $_POST["txtOwnCity"];
$sOwnState = $_POST["selOwnState"];
$sWhy = $_POST["txtWhy"];
$sView = $_POST["txtView"];
$sBusiness = $_POST["txtBusiness"];
$sDescribe = $_POST["txtDescribe"];
$sDeserve = $_POST["txtDeserve"];
$sTerms = $_POST["Terms"];


if (($sFirstName == "") || ($sLastName == "") || ($sEmailAddress == "") || ($sPhoneNumber == "") || ($sCity == "") || ($sState == "") || ($sOwnCity == "") || ($sOwnState == "") || ($sWhy == "") || ($sView == "") || ($sBusiness == "") || ($sDescribe == "") || ($sDeserve == "") || ($sTerms == ""))
{
print('<span style="color:#ffffff; font-size:14px; font-family:Arial, Helvetica, sans-serif">Please complete the Form. <a style="color:#ffffff" href="contact.html" onClick="history.go(-1);">Click here to go back</a></span>');
}
else
{
$sMailFrom = '[email protected]';

$sMailTo = '[email protected]';
$sMailSubject = 'Clean Air Lawn Care Opportunity 2010';

$sMailBody = '<p>Clean Air Lawn Care - Opportunity 2010</p>
First Name: <b>' . $sFirstName . '</b><br />
Last Name: <b>' . $sLastName . '</b><br />
Email Address: <b>' . $sEmailAddress . '</b><br />
Phone Number: <b>' . $sPhoneNumber . '</b><br />
City: <b>' . $sCity . '</b><br />
State: <b>' . $sState . '</b><br />
Franchise City: <b>' . $sOwnCity . '</b><br />
Franchise State: <b>' . $sOwnState . '</b><br />
Why do you want it: ' . $sWhy . '<br />
View on Sustainability: ' . $sView . '<br />
Business Experience: ' . $sBusiness . '<br />
Describe Yourself: ' . $sDescribe . '<br />
Why Deserving: ' . $sDeserve . '<br />'


$sMailHeaders = "From: $sMailFrom\n";
$sMailHeaders .= "Content-Type: text/html; charset=iso-8859-1\r\n";

if (mail($sMailTo, $sMailSubject, $sMailBody, $sMailHeaders))
{
	print('<span style="color:#CCFFFF; font-size:14px; font-family:Arial, Helvetica, sans-serif"><div align="center"><br /><br />Thank you, your information has been emailed!</div></span>');
}
else
{
	print('<span style="color:#CCFFFF; font-size:14px; font-family:Arial, Helvetica, sans-serif"><div align="center"><br /><br />Could not send e-mail, please contact the webmaster!</div></span>');
}


}
?>

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.