• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 337
  • Last Modified:

Alt tags in php

We are trying to get php/mysql to generate an alt tage from the content of the caption.

Two issues appear to be happening.

1) The caption has quote marks in it, so the alt text appears when mousing over the photo, but stops where the quote opens.

2) With this happening, the formatting for where the caption is supposed to be is not retained
ie, it is not showing in a table row and it is not showing in the proper font. The work when the alt tag is not there.
<img border="0" src="http://www.oursite.com/images/upload/<?echo $main_articles['image'];?> "align="left" hspace="0" alt="<?echo stripslashes($main_articles['image_caption']);?>"/> </td>
                                          <td><font face="Verdana" size="1"><?echo stripslashes($main_articles['image_caption']);?><br>
                                                <?echo stripslashes($main_articles['image_credit']);?></font></td>

Open in new window

1 Solution
htmlentities ()
alt="<?echo htmlentities (stripslashes($main_articles['image_caption']));?>"/>

Open in new window

cuttoneAuthor Commented:
That was quick, and it worked. Thanks

Featured Post

Prep for the ITIL® Foundation Certification Exam

December’s Course of the Month is now available! Enroll to learn ITIL® Foundation best practices for delivering IT services effectively and efficiently.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now