HamsterMan Posted December 1, 2006 Share Posted December 1, 2006 Echo "<A href='Index.php' onMouseOver="change('Image.Gif');" >"Any idea how i could get this to work? I need to be able to use both quote and ' inside an echo statement. Link to comment https://forums.phpfreaks.com/topic/29127-echo-problem/ Share on other sites More sharing options...
ztealmax Posted December 1, 2006 Share Posted December 1, 2006 [quote author=HamsterMan link=topic=117004.msg477095#msg477095 date=1164993934]Echo "<A href='Index.php' onMouseOver="change('Image.Gif');" >"Any idea how i could get this to work? I need to be able to use both quote and ' inside an echo statement.[/quote]try doing it like this:Echo "<A href='Index.php' onMouseOver='change('Image.Gif');' >" Link to comment https://forums.phpfreaks.com/topic/29127-echo-problem/#findComment-133531 Share on other sites More sharing options...
Psycho Posted December 1, 2006 Share Posted December 1, 2006 PHP is case sensitive. Echo needs to be all lower case. Plus the line MUST end in a semicolon. Plus, you have double quotes defining the string AND within the string. When the interpreter comes to the 2nd double quote, it thinks that's the end of the string. You should either use single quotes or escape the double quotes.echo "<a href=\"Index.php\" onMouseOver=\"change('Image.Gif');\" >"; Link to comment https://forums.phpfreaks.com/topic/29127-echo-problem/#findComment-133532 Share on other sites More sharing options...
bigmax Posted December 1, 2006 Share Posted December 1, 2006 Or you could make that intoEcho "<A href='Index.php' onMouseOver="."change('Image.Gif');".">"Practically almost the same as with '\'. Link to comment https://forums.phpfreaks.com/topic/29127-echo-problem/#findComment-133595 Share on other sites More sharing options...
kenrbnsn Posted December 1, 2006 Share Posted December 1, 2006 No, this:[code]<?phpecho "<A href='Index.php' onMouseOver="."change('Image.Gif');".">"?>[/code]is not the same as what the OP wanted.This[code]<?phpecho "<A href='Index.php' onMouseOver=".'"change('Image.Gif');"'.">";?>[/code]Produces the correct string.Ken Link to comment https://forums.phpfreaks.com/topic/29127-echo-problem/#findComment-133601 Share on other sites More sharing options...
bigmax Posted December 1, 2006 Share Posted December 1, 2006 [quote author=kenrbnsn link=topic=117004.msg477171#msg477171 date=1165000645]No, this:[code]<?phpecho "<A href='Index.php' onMouseOver="."change('Image.Gif');".">"?>[/code]is not the same as what the OP wanted.This[code]<?phpecho "<A href='Index.php' onMouseOver=".'"change('Image.Gif');"'.">";?>[/code]Produces the correct string.Ken[/quote]Oh I see...yeah...though I suppose you could do off with [code]"."'change([/code] as well Link to comment https://forums.phpfreaks.com/topic/29127-echo-problem/#findComment-133604 Share on other sites More sharing options...
kenrbnsn Posted December 1, 2006 Share Posted December 1, 2006 I was incorrect in my statement, here is the corrected one:[code]<?phpecho "<A href='Index.php' onMouseOver=".'"'. "change('Image.Gif');".'"'.">";?>[/code]Ken Link to comment https://forums.phpfreaks.com/topic/29127-echo-problem/#findComment-133606 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.