Jump to content

[SOLVED] php and ALT tags


harkly

Recommended Posts

I just added my alt tags for my images and it only gives it the first word. Is there a way to do the whole thing??

 

<td><a href='image.php?imgid=$r[imgid]' title=$title class=thickbox><img src='image/thumb/$artid/$imgid' border=0 align=left width=75 alt=$title></a></td><td valign=top><i>".$title."</i>

Link to comment
https://forums.phpfreaks.com/topic/138680-solved-php-and-alt-tags/
Share on other sites

<a href='image.php?imgid=$r[imgid]' title=$title class=thickbox>
<img src='image/thumb/$artid/$imgid' border=0 align=left width=75 alt=$title>

In that code, lets say the $title is "A phrase with spaces"

This means that the code output to the browser is like this:

 

<a href='image.php?imgid=$r[imgid]' title=A phrase with spaces class=thickbox>
<img src='image/thumb/$artid/$imgid' border=0 align=left width=75 alt=A phrase with spaces>

 

It then considers these as the properties:

A:

title = a

phrase

with

spaces

 

IMG:

alt = a

phrase

with

spaces

 

It thinks of "phrase", "with", and "spaces" as properties such as that on a select element you can set "<option ... selected>" or a checkbox can have checked written in it.

 

That is a long way to say add quotes around $title in both lines.

 

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.