LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
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



Reply
 
Search this Thread
Old 12-06-2005, 03:35 PM   #1
jamesjoy
LQ Newbie
 
Registered: Aug 2005
Location: Louth, Ireland
Distribution: FC 4
Posts: 27

Rep: Reputation: 15
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
 
Old 12-06-2005, 03:37 PM   #2
sandwhale
LQ Newbie
 
Registered: Nov 2004
Location: DFW Texas
Distribution: Debian Sarge
Posts: 20

Rep: Reputation: 0
what line #? can you post that line of code?
 
Old 12-06-2005, 04:05 PM   #3
jamesjoy
LQ Newbie
 
Registered: Aug 2005
Location: Louth, Ireland
Distribution: FC 4
Posts: 27

Original Poster
Rep: Reputation: 15
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
 
Old 12-06-2005, 04:27 PM   #4
rshaw
Senior Member
 
Registered: Apr 2001
Location: Perry, Iowa
Distribution: Mepis , Debian
Posts: 2,692

Rep: Reputation: 45
remove any extra spaces from the bottom of the file. double check your single and double quotes.
 
Old 12-06-2005, 04:27 PM   #5
sandwhale
LQ Newbie
 
Registered: Nov 2004
Location: DFW Texas
Distribution: Debian Sarge
Posts: 20

Rep: Reputation: 0
no - sorry - I was asking what line number did the error message reference? and if you would post that line of code?
 
Old 12-06-2005, 04:47 PM   #6
keefaz
Senior Member
 
Registered: Mar 2004
Distribution: Slackware
Posts: 4,617

Rep: Reputation: 136Reputation: 136
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']}
...
... 
 
Old 12-06-2005, 05:06 PM   #7
jamesjoy
LQ Newbie
 
Registered: Aug 2005
Location: Louth, Ireland
Distribution: FC 4
Posts: 27

Original Poster
Rep: Reputation: 15
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
 
Old 12-06-2005, 05:33 PM   #8
jamesjoy
LQ Newbie
 
Registered: Aug 2005
Location: Louth, Ireland
Distribution: FC 4
Posts: 27

Original Poster
Rep: Reputation: 15
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
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
PHP parse error in config.inc.php.in Confusedious Linux - Software 2 11-03-2005 06:08 AM
PHP parse error unexpected '>' ldp Programming 2 03-04-2005 03:20 PM
email send error cxtech Linux - Software 4 03-08-2004 08:31 PM
PHP Parse error.....PHPBB bentman78 Linux - Software 0 07-09-2003 07:35 AM
php parse error wujimon Linux - Software 4 03-26-2003 03:37 PM


All times are GMT -5. The time now is 01:13 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration