Jump to content


Photo

Parse error: parse error, unexpected T_CONSTANT_ENCAPSED_STRING


  • Please log in to reply
3 replies to this topic

#1 graciehz

graciehz
  • New Members
  • Pip
  • Newbie
  • 2 posts

Posted 20 July 2006 - 12:12 AM

Parse error: parse error, unexpected T_CONSTANT_ENCAPSED_STRING in F:\Program Files\Apache Group\Apache2\htdocs\ministarsnetwork2\designs\screws.inc.php on line 54

52$menu2 = "<P align=left>
53<img name=phone_item_equip_flat src=phone_item_equip_flat.png width=110 height=47 border=0 usemap=#m_phone_item_equip_flat alt=""><map name=m_phone_item_equip_flat>
54<area shape=poly coords=80,27,81,22,84,17,89,14,95,12,101,14,106,17,109,22,110,27,109,33,106,38,101,41,95,43,89,41,84,38,81,33,80,27,80,27 href=javascript:; alt="" >
55<area shape=poly coords=39,27,40,20,44,15,49,11,55,10,62,11,67,15,71,20,72,27,71,33,67,39,62,42,55,43,49,42,44,39,40,33,39,27,39,27 href=javascript:; alt="" >
56<area shape=poly coords=-1,27,0,21,4,16,9,13,15,12,21,13,26,16,30,21,31,27,30,34,26,39,21,42,15,43,9,42,4,39,0,34,-1,27,-1,27 href=javascript:; alt="" >
57</map></P>";


Would love some help.  :)

#2 Joe Haley

Joe Haley
  • Members
  • PipPipPip
  • Advanced Member
  • 103 posts
  • LocationCanada, eh?

Posted 20 July 2006 - 12:22 AM

$var = "val";

any double quotes within double quotes must be escaped with a backslash \

$var = ""val"; // bad
$var = "\"val"; // good
$var = '"val'; // also good
Give a man a fish; you have fed him for today.  Teach a man to fish; and you have fed him for a lifetime
Don't teach men to program. Teach them to fish.

Please, try the RTFM solution before asking for help:
http://php.net/manual/en/index.php

#3 AndyB

AndyB
  • Staff Alumni
  • Advanced Member
  • 5,465 posts
  • LocationToronto

Posted 20 July 2006 - 01:22 AM

Joe's response tells you why you got the error - and how to avoid them in future.

The quick solution to the specific problem you posted would be to change alt="" to alt= '' in each case, i.e. change those " to ' and they won't 'clash' with the " you used to delimit what you wanted echo'd.
Legend has it that reading the manual never killed anyone.
My site

#4 wildteen88

wildteen88
  • Staff Alumni
  • Advanced Member
  • 10,482 posts
  • LocationUK, Bournemouth

Posted 20 July 2006 - 09:29 AM

I would suggest you use HEREDOC if you have alot of HTML like so:
$menu = <<<HTML
<P align="left">
<img name="phone_item_equip_flat" src="phone_item_equip_flat.png" width="110" height="47" border="0" usemap="#m_phone_item_equip_flat" alt=""><map name="m_phone_item_equip_flat">
<area shape="poly" coords="80,27,81,22,84,17,89,14,95,12,101,14,106,17,109,22,110,27,109,33,106,38,101,41,95,43,89,41,84,38,81,33,80,27,80,27" href="javascript:void;" alt="" >
<area shape="poly" coords="39,27,40,20,44,15,49,11,55,10,62,11,67,15,71,20,72,27,71,33,67,39,62,42,55,43,49,42,44,39,40,33,39,27,39,27" href="javascript:void;" alt="" >
<area shape="poly" coords="-1,27,0,21,4,16,9,13,15,12,21,13,26,16,30,21,31,27,30,34,26,39,21,42,15,43,9,42,4,39,0,34,-1,27,-1,27" href="javascript:void;" alt="" >
</map></P>
HTML;
// dont indend the line above !!





0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users