Parse error: syntax error, unexpected T_ENCAPSED_AND_WHITESPACE, expecting T_STRING..

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • mmvazir
    New Member
    • Mar 2010
    • 6

    Parse error: syntax error, unexpected T_ENCAPSED_AND_WHITESPACE, expecting T_STRING..

    Error:

    Parse error: syntax error, unexpected T_ENCAPSED_AND_ WHITESPACE, expecting T_STRING or T_VARIABLE or T_NUM_STRING in /home/content/78/5927878/html/contactform.php on line 15

    Code:
    <?php
    
    		echo $_POST['firstname'];
    		
    		$to = "****@****.com";
    		$bcc = "****@****.net";
    		$subject = "Email Subscription Form";
    		$headers = "From: $email\r\n" . 
    			"Bcc: $bcc\r\n" . 
    			"Content-Type: text/html";
    			
    		echo $_POST['firstname'];
    	
    		$strHtml = "<font face=Arial size=1><table width=450 border=1>" .
    		"<tr><td>Full Name</td><td> $_POST['fullname'] </td></tr>" .
    		"<tr><td>Email Address</td><td> $_POST['email'] </td></tr>" .
    		"<tr><td>Telephone</td><td> $_POST['telephone'] </td></tr>" .
    		"<tr><td>Industry</td><td> $_POST['industry'] </td></tr>" .
    		"<tr><td>Job Title</td><td> $_POST['jobtitle'] </td></tr>" .
    		"<tr><td>Country</td><td> $_POST['country'] </td></tr>" .
    		"</table></font>";
    
    		if (mail($to, $subject, $strHtml, $headers))
    		{
    			echo("<script>
    			<!--
    				location.replace(\"thanks.html\");
    			-->
    			</script>" );
    		} 
    ?>
    Last edited by acoder; Dec 30 '12, 12:33 PM. Reason: Hidden emails in code. Please be careful when posting code
  • Rabbit
    Recognized Expert MVP
    • Jan 2007
    • 12517

    #2
    I don't know if this is the issue but when you want to resolve arrays in strings, you don't need to put quotes around the index.

    Comment

    • Dormilich
      Recognized Expert Expert
      • Aug 2008
      • 8694

      #3
      or rather, if you use quoted keys, you need to enclose the whole variable in curly braces. see PHP’s String section for detailed information.

      Comment

      Working...