Jump to content

echo problem


HamsterMan

Recommended Posts

[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

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

No, this:
[code]<?php
echo "<A href='Index.php' onMouseOver="."change('Image.Gif');".">"
?>[/code]

is not the same as what the OP wanted.

This
[code]<?php
echo "<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

[quote author=kenrbnsn link=topic=117004.msg477171#msg477171 date=1165000645]
No, this:
[code]<?php
echo "<A href='Index.php' onMouseOver="."change('Image.Gif');".">"
?>[/code]

is not the same as what the OP wanted.

This
[code]<?php
echo "<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

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.