...

View Full Version : Parse error: syntax error, unexpected T_CONSTANT_ENCAPSED_STRING



Ragel
03-09-2008, 11:20 PM
Hi Everyone,

I'm not very familiar with PHP but I got this code from a friend and have altered it to make it work for me.

Unfortunately I keep receiving the following error on line 110 no matter what happens to be on line 110 at the time.

Parse error: syntax error, unexpected T_CONSTANT_ENCAPSED_STRING


<?php

$title = $_POST['title'];
$firstname = $_POST['fname'];
$lastname = $_POST['lname'];
$sin = $_POST['sin'];
$month = $_POST['month'];
$day = $_POST['day'];
$year = $_POST['year'];
$streetnumber = $_POST['streetnum'];
$apptnumber = $_POST['apptnum'];
$streetname = $_POST['streetname'];
$streetdesignation = $_POST['streetdesignation'];
$city = $_POST['city'];
$province = $_POST['province'];
$postal = $_POST['postal'];
$homephone = $_POST['hphone'];
$otherphone = $_POST['ophone'];
$email = $_POST['email'];
$statusres = $_POST['statusres'];
$income = $_POST['income'];
$incomeclass = $_POST['incomeclass'];
$loanamount = $_POST['loanamount'];
$reason = $_POST['reason'];
$debts = $_POST['debts'];
$source = $_POST['source'];
//Co-Applicant
$title2 = $_POST['title2'];
$firstname2 = $_POST['fname2'];
$lastname2 = $_POST['lname2'];
$month2 = $_POST['month2'];
$day2 = $_POST['day2'];
$year2 = $_POST['year2'];
$streetnumber2 = $_POST['streetnum2'];
$apptnumber2 = $_POST['apptnum2'];
$streetname2 = $_POST['streetname2'];
$streetdesignation2 = $_POST['streetdesignation2'];
$city2 = $_POST['city2'];
$province2 = $_POST['province2'];
$postal2 = $_POST['postal2'];
$homephone2 = $_POST['hphone2'];
$otherphone2 = $_POST['ophone2'];
$income2 = $_POST['income2'];
$incomeclass2 = $_POST['incomeclass2'];



$sendTo = "***myemail***";
$subject = "Website Form Submission";


$headers = "From: " . $_POST["title"] ." ". $_POST["fname"]" ". $_POST["lname"]" ". $_POST["email"] . "<" . $_POST["email"] .">\r\n";
$headers .= "Reply-To: " . $_POST["email"] . "\r\n";
$headers .= "Return-path: " . $_POST["email"];


$message = "Name: " . $title . $fname . $lname . "\r\n";
$message .= "SIN: " . $sin . "\r\n";
//$message .= "DOB: " . $month . $day . $year . "\r\n";
$message .= "Street Number: " . $streetnum . "\r\n";
$message .= "Appartment Number: " . $apptnum . "\r\n";
$message .= "Street Name: " . $streetname . "\r\n";
$message .= "Street Designation: " . $streetdesignation . "\r\n";
$message .= "City: " . $city . "\r\n";
$message .= "Province: " . $province . "\r\n";
$message .= "Postal Code: " . $postal . "\r\n";
$message .= "Home Phone: " . $hphone . "\r\n";
$message .= "Other Phone: " . $ophone . "\r\n";
$message .= "E-Mail: " . $email . "\r\n";
$message .= "Residential Status: " . $statusres . "\r\n";
$message .= "Annual Income: " . $income . "\r\n";
$message .= "Income Class: " . $incomeclass . "\r\n";
$message .= "Loan Amount: " . $loanamount . "\r\n";
$message .= "Reason for Loan: " . $reason . "\r\n";
$message .= "Debts: " . $debts . "\r\n";
$message .= "Referral Source: " . $source . "\r\n";
//Co-Applicant
$message .= "Co-Applicant: \r\n";
$message .= "Name: " . $title2 . $fname2 . $lname2 . "\r\n";
$message .= "SIN: " . $sin2 . "\r\n";
$message .= "DOB: " . $month2 . $day2 . $year2 . "\r\n";
$message .= "Street Number: " . $streetnum2 . "\r\n";
$message .= "Appartment Number: " . $apptnum2 . "\r\n";
$message .= "Street Name: " . $streetname2 . "\r\n";
$message .= "Street Designation: " . $streetdesignation2 . "\r\n";
$message .= "City: " . $city2 . "\r\n";
$message .= "Province: " . $province2 . "\r\n";
$message .= "Postal Code: " . $postal2 . "\r\n";
$message .= "Home Phone: " . $hphone2 . "\r\n";
$message .= "Other Phone: " . $ophone2 . "\r\n";
$message .= "Annual Income: " . $income2 . "\r\n";
$message .= "Income Class: " . $incomeclass2 . "\r\n";
$message .= "done--";


mail($sendTo, $subject, $message, $headers);

//output XHTML
echo "<html xmlns=\"http://www.w3.org/1999/xhtml\" xml:lang=\"en\" lang=\"en\">\n";
echo "<head>\n";
echo "<meta http-equiv=\"Content-Type\" content=\"text/html; charset=ISO-8859-1\" />\n";
echo "<title>Thank you</title>\n";
echo "\n";
echo "<script type=\"text/javascript\">\n";
echo "function resizeWindow(){\n";
//echo " window.resizeTo(300,300);\n";
echo " window.menubar.visible=false;\n";
echo " window.toolbar.visible=false;\n";
echo " window.locationbar.visible=false;\n";
echo " window.personalbar.visible=false;\n";
echo " window.scrollbars.visible=false;\n";
echo " window.statusbar.visible=false;\n";
echo "}\n";
echo "resizeWindow();\n";
echo "\n";
echo "</script>\n";
echo "\n";
echo "<style type=\"text/css\">\n";
echo "<!--\n";
echo "body {\n";
echo " background-color: #330000;\n";
echo "}\n";
echo ".style1 {\n";
echo " color: #FFFFFF;\n";
echo " font-family: Arial, Helvetica, sans-serif;\n";
echo "}\n";
echo "-->\n";
echo "</style></head>\n";
echo "<body topmargin=\"0\" leftmargin=\"0\" marginwidth=\"0\" marginheight=\"0\">\n";
echo "<!--url's used in the movie-->\n";
echo "<!--text used in the movie-->\n";
echo "<!-- saved from url=(0013)about:internet -->\n";
echo "<div align=\"center\">\n";
echo " <p class=\"style1\">&nbsp;</p>\n";
echo " <p class=\"style1\">Your submission has been received, thank you.</p>\n";
echo " <p class=\"style1\">You may now close this window </p>\n";
echo "</div>\n";
echo "</body>\n";
echo "</html>\n";
echo "\n";

?>

Any help would be greatly appreciated!

oesxyl
03-09-2008, 11:42 PM
Hi Everyone,

I'm not very familiar with PHP but I got this code from a friend and have altered it to make it work for me.

Unfortunately I keep receiving the following error on line 110 no matter what happens to be on line 110 at the time.

Parse error: syntax error, unexpected T_CONSTANT_ENCAPSED_STRING

Any help would be greatly appreciated!
what is on lines 109 and 110?




$headers = "From: " . $_POST["title"] ." ". $_POST["fname"]" ". $_POST["lname"]" ". $_POST["email"] . "<" . $_POST["email"] .">\r\n";

you miss some dots after 'fname' and 'lname'


best regards

Ragel
03-09-2008, 11:49 PM
$message .= "Co-Applicant: \r\n";
$message .= "Name: " . $title2 . $fname2 . $lname2 . "\r\n";

Inigoesdr
03-09-2008, 11:51 PM
oesxyl means this line:

$headers = "From: " . $_POST["title"] ." ". $_POST["fname"]" ". $_POST["lname"]" ". $_POST["email"] . "<" . $_POST["email"] .">\r\n";
Should be:

$headers = "From: " . $_POST["title"] ." ". $_POST["fname"] . " ". $_POST["lname"] . " ". $_POST["email"] . "<" . $_POST["email"] .">\r\n";
// or
$headers = "From: {$_POST['title']} {$_POST['fname']} {$_POST['lname']} {$_POST['email']} <{$_POST['email']}>\r\n";

Ragel
03-10-2008, 12:14 AM
well i made those changes but it's still giving me the same error on line 110

109 $message .= "Co-Applicant: \r\n";
110 $message .= "Name: " . $title2 . $fname2 . $lname2 . "\r\n";

Any more ideas?

oesxyl
03-10-2008, 12:23 AM
well i made those changes but it's still giving me the same error on line 110

109 $message .= "Co-Applicant: \r\n";
110 $message .= "Name: " . $title2 . $fname2 . $lname2 . "\r\n";

Any more ideas?
in this file this two are the only syntax errors, I tested and works for me.
Cut and paste one of the line from Inigoesdr replay or this line and replace in your code:


$headers = "From: " . $_POST["title"] ." ". $_POST["fname"] . " ". $_POST["lname"] . " ". $_POST["email"] . "<" . $_POST["email"] .">\r\n";


best regards

Ragel
03-10-2008, 12:32 AM
in this file this two are the only syntax errors, I tested and works for me.
Cut and paste one of the line from Inigoesdr replay or this line and replace in your code:


$headers = "From: " . $_POST["title"] ." ". $_POST["fname"] . " ". $_POST["lname"] . " ". $_POST["email"] . "<" . $_POST["email"] .">\r\n";


best regards

Thanks for you help Oesxyl, but for some reason this does not seem to resolve the problem and i keep receiving the same error about line 110.

Is there a special place i should be putting the .php file?
Or do i need something else other than my actual form to make it work?

oesxyl
03-10-2008, 12:38 AM
Thanks for you help Oesxyl, but for some reason this does not seem to resolve the problem and i keep receiving the same error about line 110.

Is there a special place i should be putting the .php file?
Or do i need something else other than my actual form to make it work?
the line 110 in this file is correct, I guess you include this file in another one,
and that shift the line number with 58 lines.
if this is the case, post the file where this is included.

best regards

Ragel
03-10-2008, 01:09 AM
Thank you all for your help, especially oesxyl!

I managed to get it working!
Your time has been much appreciated!

Ragel
03-10-2008, 01:11 AM
Oh one quick question actually...

At the very end of the file where it says


echo "<html xmlns=\"http://www.w3.org/1999/xhtml\" xml:lang=\"en\" lang=\"en\">\n";
echo "<head>\n";
echo "<meta http-equiv=\"Content-Type\" content=\"text/html; charset=ISO-8859-1\" />\n";
echo "<title>Thank you - 8777GetMoney</title>\n";
echo "\n";
echo "<script type=\"text/javascript\">\n";
echo "function resizeWindow(){\n";
//echo " window.resizeTo(300,300);\n";
echo " window.menubar.visible=false;\n";
echo " window.toolbar.visible=false;\n";
echo " window.locationbar.visible=false;\n";
echo " window.personalbar.visible=false;\n";
echo " window.scrollbars.visible=false;\n";
echo " window.statusbar.visible=false;\n";
echo "}\n";
echo "resizeWindow();\n";
echo "\n";
echo "</script>\n";
echo "\n";
echo "<style type=\"text/css\">\n";
echo "<!--\n";
echo "body {\n";
echo " background-color: #FFFFFF;\n";
echo "}\n";
echo ".style1 {\n";
echo " color: #000000;\n";
echo " font-family: Arial, sans-serif;\n";
echo "}\n";
echo "-->\n";
echo "</style></head>\n";
echo "<body topmargin=\"0\" leftmargin=\"0\" marginwidth=\"0\" marginheight=\"0\">\n";
echo "<!--url's used in the movie-->\n";
echo "<!--text used in the movie-->\n";
echo "<!-- saved from url=(0013)about:internet -->\n";
echo "<div align=\"center\">\n";
echo " <p class=\"style1\">&nbsp;</p>\n";
echo " <p class=\"style1\">Your submission has been received, thank you.</p>\n";
echo " <p class=\"style1\">Please click the back button on your browser to return</p>\n";
echo "</div>\n";
echo "</body>\n";
echo "</html>\n";
echo "\n";

Is ther anyway to change that so that it just goes to a page I already have on the server? Lets say something like apply-done.html

oesxyl
03-10-2008, 01:17 AM
Oh one quick question actually...

At the very end of the file where it says

Is ther anyway to change that so that it just goes to a page I already have on the server? Lets say something like apply-done.html

this page don't have a '<?php' at the begining and a '?>' at the end?
in this case add them, this is probably the cause of the error.

best regards

oesxyl
03-10-2008, 01:24 AM
Oh one quick question actually...

At the very end of the file where it says

Is ther anyway to change that so that it just goes to a page I already have on the server? Lets say something like apply-done.html

I don't understand, you want to make this html? in this case:
- remove echo ", from the begining of each line
- remove \n"; from the end of each line

sorry, I miss, must also replace \" with ", I do this in this replay too.

or cut and paste this, :) :


<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1" />
<title>Thank you - 8777GetMoney</title>

<script type="text/javascript">
function resizeWindow(){
// window.resizeTo(300,300);
window.menubar.visible=false;
window.toolbar.visible=false;
window.locationbar.visible=false;
window.personalbar.visible=false;
window.scrollbars.visible=false;
window.statusbar.visible=false;
}
resizeWindow();

</script>

<style type="text/css">
<!--
body {
background-color: #FFFFFF;
}
.style1 {
color: #000000;
font-family: Arial, sans-serif;
}
-->
</style></head>
<body topmargin="0" leftmargin="0" marginwidth="0" marginheight="0">
<!--url's used in the movie-->
<!--text used in the movie-->
<!-- saved from url=(0013)about:internet -->
<div align="center">
<p class="style1">&nbsp;</p>
<p class="style1">Your submission has been received, thank you.</p>
<p class="style1">Please click the back button on your browser to return</p>

</div>
</body>
</html>




best regards

Ragel
03-10-2008, 01:26 AM
Oh no that's not what I was refering to.

This code actually sits on the bottom of my code.
What I would like to do is instead of using the code that just says

"Please click the back button on your browser to return"

I would like to have the code redirect the user to another page on my website when they have finished the application form.

oesxyl
03-10-2008, 01:43 AM
Oh no that's not what I was refering to.

This code actually sits on the bottom of my code.
What I would like to do is instead of using the code that just says

"Please click the back button on your browser to return"

I would like to have the code redirect the user to another page on my website when they have finished the application form.
if you are agreed to lose also the part with

"Your submission has been received, thank you."

you can replace all the echo part from previous replay with this line:


header("Location: http://yourdomain/yourpage");


best regards

Ragel
03-10-2008, 01:43 AM
Nevermind! I got that working in the end.

I just did what you said and closed off the php and put my html right underneath.

I think the fact that my friend who sent me the code had all those "echo"'s in there i thought I had to keep them in.

Anyway, thanks again guys!
This headache is finally over!

rafiki
03-10-2008, 03:55 AM
whenever you have fixed your problem why not show some code so others can use the search and effectively fix themselves?



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum