2014-03-24 17 views
0

任何人都知道我爲什麼會收到以下錯誤消息?解析錯誤:語法錯誤,/ usr/local/4admin/apache/vhosts中的意外T_STRING/

Parse error: syntax error, unexpected T_STRING in /usr/local/4admin/apache/vhosts/abmhd.com/httpdocs/Forms/Email.php on line 11 " Line 11 is " $recipient = "[email protected] "

<?php 
$name = $_POST['name']; 
$email = $_POST['email']; 
$phone = $_POST['phone']; 
$call = $_POST['call']; 
$website = $_POST['website']; 
$priority = $_POST['priority']; 
$type = $_POST['type']; 
$message = $_POST['message']; 
$formcontent=" From: $name \n Phone: $phone \n Call Back: $call \n Website:   $website \n Priority: $priority \n Type: $type \n Message: $message"; 
$recipient = "[email protected]<script type="text/javascript"> 
/* <![CDATA[ */ 
(function(){try{var  s,a,i,j,r,c,l,b=document.getElementsByTagName("script");l=b[b.length-1].previousSibling;a=l.getAttribute('data-cfemail');if(a) {s='';r=parseInt(a.substr(0,2),16);for(j=2;a.length-j;j+=2) {c=parseInt(a.substr(j,2),16)^r;s+=String.fromCharCode(c);}s=document.createTextNode(s);l.parentNode.replaceChild(s,l);}}catch(e){}})(); 
/* ]]> */ 
</script>"; 
$subject = "Contact Form"; 
$mailheader = "From: $email \r\n"; 
mail($recipient, $subject, $formcontent, $mailheader) or die("Error!"); 
echo "Thank You!"; 
?>` 
+0

轉義$收件人中的雙引號var – Danijel

+3

快速查看你的問題的顏色應該給你一個提示;) –

+0

$ formcontent缺少一個結束報價。 – j08691

回答

1

你應該逃避這樣的:

$recipient = "[email protected]<script type=\"text/javascript\"> 

和變量定義中的一樣爲人人「

或者,也許更容易改變外雙引號單者。

0

您需要爲標籤(也是js cod內部的引號) e):

<?php 
$name = $_POST['name']; 
$email = $_POST['email']; 
$phone = $_POST['phone']; 
$call = $_POST['call']; 
$website = $_POST['website']; 
$priority = $_POST['priority']; 
$type = $_POST['type']; 
$message = $_POST['message']; 
$formcontent=" From: $name \n Phone: $phone \n Call Back: $call \n Website:   $website \n Priority: $priority \n Type: $type \n Message: $message"; 
$recipient = "[email protected]<script type=\"text/javascript\"> 
/* <![CDATA[ */ 
(function(){try{var  s,a,i,j,r,c,l,b=document.getElementsByTagName(\"script\");l=b[b.length-1].previousSibling;a=l.getAttribute('data-cfemail');if(a) {s='';r=parseInt(a.substr(0,2),16);for(j=2;a.length-j;j+=2) {c=parseInt(a.substr(j,2),16)^r;s+=String.fromCharCode(c);}s=document.createTextNode(s);l.parentNode.replaceChild(s,l);}}catch(e){}})(); 
/* ]]> */ 
</script>"; 
$subject = "Contact Form"; 
$mailheader = "From: $email \r\n"; 
mail($recipient, $subject, $formcontent, $mailheader) or die("Error!"); 
echo "Thank You!"; 
?> 

另外,用引號括住變量是很好的做法。

+0

嘿傢伙,我嘗試了所有的建議。 ..沒有任何工作!我會很感激您可能會想到的任何其他方式。 –

相關問題