...

View Full Version : Quick question about some Parse error (unexpecte T_ENCAPSED...)



mypointofview
09-08-2005, 12:50 AM
Parse error: parse error, unexpected T_ENCAPSED_AND_WHITESPACE, expecting T_STRING or T_VARIABLE or T_NUM_STRING in /export/home/mylogin/public_html/myfile.php on line 6

BTW -- what does the "T_" stand for?

Here's the code (thanks to CYPHIX). I started right at the top of the document, but this error appears (with different line numbers) no matter where in my html I place it. Before my form or after -- always. When I used the other php code in the other thread here (http://www.codingforums.com/showthread.php?t=67546), not using $_POST, it was all fine!


<?php
$sendto="myname@mydomain.com";
$emailsubject="Reply from Website";
$thankyou="http://www.mydomain.com/thanks.html";
$msg = 'Tel: ' . $visitorPhone . "\r\n" . stripslashes($comments);
$from = "From: $_POST['visitorName'] <$_POST['visitorEmail']>\n";

if ($_POST['submit_x']) {
mail($sendto, $emailsubject, $msg, $from);
header("Location: $thankyou");
}

?>

BTW all registers are set to ON in the php.ini Also I should mention that I upload in ASCII mode (not knowing what that does or if it's even necessary but it seems more PRO?)

:confused: Martin.

missing-score
09-08-2005, 01:22 AM
Try changing this line:

$from = "From: $_POST['visitorName'] <$_POST['visitorEmail']>\n";

to:



$from = "From: ".$_POST['visitorName']." <".$_POST['visitorEmail'].">\n";

mypointofview
09-08-2005, 04:42 AM
That did it for that one -- THANKS!! :thumbsup:

firepages
09-09-2005, 06:46 AM
BTW -- what does the "T_" stand for?


Token

One of the first stages of the PHP parsing process involves `tokenizing`your source into specific elements that PHP/Zend knows how to deal with.

See the tokenizer (http://www.php.net/tokenizer) functions for more info.

e-Raser
09-09-2005, 12:20 PM
Just saying, if you get a parse error, they aren't usually on the line it says its on. Always try looking at the coding around it for unclosed quotes, a missing ; or anything else like that.



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum