Third tier quotations?

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
Citizen
Forum Contributor
Posts: 300
Joined: Wed Jul 20, 2005 10:23 am

Third tier quotations?

Post by Citizen »

Code: Select all

echo "
<td style='vertical-align:bottom;'>

<div class='item2' onmouseover='this.className="item2"; onmouseout='this.className="item2";'>
<a href='$VAR[0]/arcade.php'>Random</a>
</div>

</td>
";
What do I do about "item2" when it is incased in a '?

Wont that end my echo command?
User avatar
hawleyjr
BeerMod
Posts: 2170
Joined: Tue Jan 13, 2004 4:58 pm
Location: Jax FL & Spokane WA USA

Post by hawleyjr »

You need to escape your double quotes. Also your variable won't parse the way you have it. you need to do something like this:

Code: Select all

echo "
<td style='vertical-align:bottom;'>

<div class='item2' onmouseover='this.className=\"item2\"; onmouseout='this.className=\"item2\";'>
<a href='" . $VAR[0] . "/arcade.php'>Random</a>
</div>

</td>
";
Citizen
Forum Contributor
Posts: 300
Joined: Wed Jul 20, 2005 10:23 am

Post by Citizen »

Thanks a ton!

Also, I thought that you dont need to close and reopen the string to include a variable if you use " instead of ' when using the echo command.
User avatar
hawleyjr
BeerMod
Posts: 2170
Joined: Tue Jan 13, 2004 4:58 pm
Location: Jax FL & Spokane WA USA

Post by hawleyjr »

Citizen wrote:Thanks a ton!

Also, I thought that you dont need to close and reopen the string to include a variable if you use " instead of ' when using the echo command.
You don't. Just a (Good) habit :)
Post Reply