Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game. |
| Notices |
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
Are you new to LinuxQuestions.org? Visit the following links:
Site Howto |
Site FAQ |
Sitemap |
Register Now
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
 |
GNU/Linux Basic Guide
This 255-page guide will provide you with the keys to understand the philosophy of free software, teach you how to use and handle it, and give you the tools required to move easily in the world of GNU/Linux. Many users and administrators will be taking their first steps with this GNU/Linux Basic guide and it will show you how to approach and solve the problems you encounter.
Click Here to receive this Complete Guide absolutely free. |
|
 |
12-06-2005, 02:35 PM
|
#1
|
|
LQ Newbie
Registered: Aug 2005
Location: Louth, Ireland
Distribution: FC 4
Posts: 27
Rep:
|
php send email parse error, unexpected T_ENCAPSED_AND_WHITESPACE, expect
Trying to set up this thing sending emails to users. Having small bit of troubel keep getting this error when tha page loads and gogling it didnt produce much luck. I ve another page running using the same code with a simpler body which runs fine so very confised.
ERROR:
Parse error: parse error, unexpected T_ENCAPSED_AND_WHITESPACE, expecting T_STRING or T_VARIABLE or T_NUM_STRING
Code:
$to = $row53['email'];
$subject = 'Contact Info';
$body = <<< emailbody
Dear $row53['fName'] $row53['sName']
The contact information follows...
Name: $row54['fName'] $row54['fName']
Mobile: $row54['mobile']
Addres: $row54['add1']
$row54['add2']
$row54['add3']
$row54['add4']
$row54['town']
$row54['county']
Thank You
emailbody;
$headers = 'james@lidiot.net';
mail($to, $subject, $body, $headers);
###########################################################
Thanks for any help
james
|
|
|
|
12-06-2005, 02:37 PM
|
#2
|
|
LQ Newbie
Registered: Nov 2004
Location: DFW Texas
Distribution: Debian Sarge
Posts: 20
Rep:
|
what line #? can you post that line of code?
|
|
|
|
12-06-2005, 03:05 PM
|
#3
|
|
LQ Newbie
Registered: Aug 2005
Location: Louth, Ireland
Distribution: FC 4
Posts: 27
Original Poster
Rep:
|
sorry those #### where just the divide between the code and the edn of the email not sure how to do those cool boxes round the code.
Thanks for the reply though
|
|
|
|
12-06-2005, 03:27 PM
|
#4
|
|
Senior Member
Registered: Apr 2001
Location: Perry, Iowa
Distribution: Mepis , Debian
Posts: 2,694
Rep:
|
remove any extra spaces from the bottom of the file. double check your single and double quotes.
|
|
|
|
12-06-2005, 03:27 PM
|
#5
|
|
LQ Newbie
Registered: Nov 2004
Location: DFW Texas
Distribution: Debian Sarge
Posts: 20
Rep:
|
no - sorry - I was asking what line number did the error message reference? and if you would post that line of code?
|
|
|
|
12-06-2005, 03:47 PM
|
#6
|
|
Senior Member
Registered: Mar 2004
Distribution: Slackware
Posts: 4,282
Rep:
|
I think you need to pack your array variables with ${} as :
PHP Code:
Dear ${row53['fName']} ${row53['sName']}
The contact information follows...
Name: ${row54['fName']} ${row54['fName']} Mobile: ${row54['mobile']} ... ...
|
|
|
|
12-06-2005, 04:06 PM
|
#7
|
|
LQ Newbie
Registered: Aug 2005
Location: Louth, Ireland
Distribution: FC 4
Posts: 27
Original Poster
Rep:
|
it complains about this line from a different send email section of the code.
$to = $row53['email'];
----------------------
Removed spaces from bottom of page just after the close sign "?>" No change
----------------------
Checked all single and double quotes and they all seem in order.
----------------------
Packed variable to but had no luck
-----------------------
Part of the problem is that i dont understand what the error is telling me. Maybe if you knew you could enlighten me and might help me find the problem if i knew what i m kind of looking for!!!!!
Thanks for all the help
james
|
|
|
|
12-06-2005, 04:33 PM
|
#8
|
|
LQ Newbie
Registered: Aug 2005
Location: Louth, Ireland
Distribution: FC 4
Posts: 27
Original Poster
Rep:
|
Playing around with the code I found the problem.
It was as was suggested a blank space after the line of code
$body = <<< emailbody
after accidentally finding and removing the space after the word emailbody it worked fine.
I would be right in saying that that error basically means you have a space where it shouldn't be. Didnt think php was so picky.
Thanks a million for all the response!
james
Thanks
|
|
|
|
| Thread Tools |
Search this Thread |
|
|
|
Posting Rules
|
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
HTML code is Off
|
|
|
All times are GMT -5. The time now is 12:19 AM.
|
|
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.
|
Latest Threads
LQ News
|
|