Jump to content

Text from a hover


Hooch

Recommended Posts

Hello all. I have the code working except when the text has quotes. Here is the code...

<a href="art2.php?id=<?PHP echo $r['id']?>"><img src="images/items/<?PHP echo $r['gallery_id']?>-T.jpg" alt="<?PHP echo stripslashes($r['title'])?>" width="118" height="118" border="0" class="pic-border" style="background-color: #869AA1" />

I thought this would work...

alt="<?PHP echo stripslashes($r['title'])?>"

There are about 20 pictures on this page and all have text when I hover except the 1. The text that does not show is as follows... "Gros Mourne" Nfdl. BTW this is coded for IE (Customer request) Hooch

Link to comment
Share on other sites

You mean that $r['title] can have quotes? Well, in that case, simply escape them to entities like so:

alt="<?PHP echo htmlspecialchars(stripslashes($r['title']),ENT_QUOTES)?>"

(with this, you're also safely escaping "<", ">" and "&" btw)

Link to comment
Share on other sites

Archived

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

×
×
  • Create New...