Jump to content

unexpected T_ENCAPSED_AND_WHITESPACE


aebstract

Recommended Posts

<input type=\"text\" class=\"txt\" name=\"name\" maxlength=\"20\" size=\"20\" value=\"' . $_POST['name'] . '\" />

 

I've used code just like this before without error, anyone know what is wrong?

 

Parse error: syntax error, unexpected T_ENCAPSED_AND_WHITESPACE, expecting T_STRING or T_VARIABLE or T_NUM_STRING in /homepages/12/d224766608/htdocs/web-vrd/new/contact.php on line 16

Link to comment
Share on other sites

That's the line with the problem, take that line out and there is no error. Put it in and the error comes up, why would you need more code for this?

 

edit:

enjoy

<?php

if (isset($_POST['submit'])){


}

$content .= "
<p class=\"bodycontent\">

<table width=\"750\">
<tr>
<td valign=\"top\" width=\"400\">
<form method=\"POST\" action=\"index.php?page=contact\">
Name: 
<input type=\"text\" class=\"txt\" name=\"name\" maxlength=\"20\" size=\"20\" value=\"' . $_POST['name'] . '\" />

<br /><br />
<input type=\"submit\" value=\"Send\" />
</form>
</td>
<td align=\"right\" valign=\"top\">
241 Castleberry Industrial Drive, Suite B<br />
Cumming, GA 30040
<br /><br />

Phone: 678-513-7105<br />
Fax: 678-513-7063<br /><br /><br />

<center>
Mike (Owner/President)<br />
<a href=\"mailto:mike@vengeancerd.com\">mike@vengeancerd.com</a><br /><br />

Ron Mowen (General Manager/Sales)<br />
<a href=\"mailto:ron@vengeancerd.com\">ron@vengeancerd.com</a><br /><br />

Buddy Daniel (Project Specialist/Technician)<br />
<a href=\"mailto:buddy@vengeancerd.com\">buddy@vengeancerd.com</a><br /><br />

Charlie Hill (Pedders Suspension Specialist)<br />
<a href=\"mailto:charlieh@vengeancerd.com\">charlieh@vengeancerd.com</a><br /><br />


</center>

</td>
</tr>
</table>


<center>
<iframe width=\"425\" height=\"350\" frameborder=\"0\" scrolling=\"no\" marginheight=\"0\" marginwidth=\"0\" src=\"http://maps.google.com/maps?f=q&hl=en&geocode=&q=241+Castleberry+Industrial+Dr+Cumming,+GA+30040-9051,+US&sll=37.0625,-95.677068&sspn=33.764224,79.101563&ie=UTF8&ll=34.207614,-84.144716&spn=0.008608,0.019312&z=14&g=241+Castleberry+Industrial+Dr+Cumming,+GA+30040-9051,+US&output=embed&s=AARTsJoOEagJWyUHYTOwV8tNEUfVYaHWXQ\"></iframe><br /><small><a href=\"http://maps.google.com/maps?f=q&hl=en&geocode=&q=241+Castleberry+Industrial+Dr+Cumming,+GA+30040-9051,+US&sll=37.0625,-95.677068&sspn=33.764224,79.101563&ie=UTF8&ll=34.207614,-84.144716&spn=0.008608,0.019312&z=14&g=241+Castleberry+Industrial+Dr+Cumming,+GA+30040-9051,+US&source=embed\" style=\"color:#0000FF;text-align:left\" target=\"_blank\">View Larger Map</a></small>
</center>


</p>
";

?>

Link to comment
Share on other sites

You are breaking out incorrectly. You open the string with " but you try to break out with '.

 

<input type=\"text\" class=\"txt\" name=\"name\" maxlength=\"20\" size=\"20\" value=\"" . $_POST['name'] . "\" />

 

Why don't you just use the heredoc syntax?

 

<?php

if (isset($_POST['submit'])){


}

$content .= <<<html
<p class="bodycontent">

<table width="750">
<tr>
<td valign="top" width="400">
<form method="POST" action="index.php?page=contact">
Name: 
<input type="text" class="txt" name="name" maxlength="20" size="20" value="{$_POST['name']}" />

<br /><br />
<input type="submit" value="Send" />
</form>
</td>
<td align="right" valign="top">
241 Castleberry Industrial Drive, Suite B<br />
Cumming, GA 30040
<br /><br />

Phone: 678-513-7105<br />
Fax: 678-513-7063<br /><br /><br />

<center>
Mike (Owner/President)<br />
<a href="mailto:mike@vengeancerd.com">mike@vengeancerd.com</a><br /><br />

Ron Mowen (General Manager/Sales)<br />
<a href="mailto:ron@vengeancerd.com">ron@vengeancerd.com</a><br /><br />

Buddy Daniel (Project Specialist/Technician)<br />
<a href="mailto:buddy@vengeancerd.com">buddy@vengeancerd.com</a><br /><br />

Charlie Hill (Pedders Suspension Specialist)<br />
<a href="mailto:charlieh@vengeancerd.com">charlieh@vengeancerd.com</a><br /><br />


</center>

</td>
</tr>
</table>


<center>
<iframe width="425" height="350" frameborder="0" scrolling="no" marginheight="0" marginwidth="0" src="http://maps.google.com/maps?f=q&hl=en&geocode=&q=241+Castleberry+Industrial+Dr+Cumming,+GA+30040-9051,+US&sll=37.0625,-95.677068&sspn=33.764224,79.101563&ie=UTF8&ll=34.207614,-84.144716&spn=0.008608,0.019312&z=14&g=241+Castleberry+Industrial+Dr+Cumming,+GA+30040-9051,+US&output=embed&s=AARTsJoOEagJWyUHYTOwV8tNEUfVYaHWXQ"></iframe><br /><small><a href="http://maps.google.com/maps?f=q&hl=en&geocode=&q=241+Castleberry+Industrial+Dr+Cumming,+GA+30040-9051,+US&sll=37.0625,-95.677068&sspn=33.764224,79.101563&ie=UTF8&ll=34.207614,-84.144716&spn=0.008608,0.019312&z=14&g=241+Castleberry+Industrial+Dr+Cumming,+GA+30040-9051,+US&source=embed" style="color:#0000FF;text-align:left" target="_blank">View Larger Map</a></small>
</center>


</p>
html;

?>

Link to comment
Share on other sites

why would you need more code for this?

 

Because the line you showed is completely out of context.

 

For starters. This part here....

 

' . $_POST['name'] . '

 

Looks like your trying to exit the string and display the $_POST['name'] array elements value. However, your ending (or attempting to) the string using sinlge quotes. Your entire string is within double quotes.

 

Replace that with....

 

{$_POST['name']}

 

and see how you go. (I don't think that is the source of your error though)

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.