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>
                                        </tr>
                                        <tr>
                                          <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

cuttoneAsked:
Who is Participating?
 
Michael701Connect With a Mentor Commented:
htmlentities ()
alt="<?echo htmlentities (stripslashes($main_articles['image_caption']));?>"/>

Open in new window

0
 
cuttoneAuthor Commented:
That was quick, and it worked. Thanks
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.