How to print IMG tag... xhtml sytlee

Hello all EEs... I have a PHP quickie.

I am trying to dynamically write some IMG stars within a PHP for loop,
however they need to be XHTML compliant - WITH a closing slash, like so:

$star="<img src='images/star.gif' height='12px' width='12px' alt='someALT' />";
(... the above will not output the closing slash)

How can I ensure that the backslash is present within the generated IMG tags?

Thanks muchly as time is of the essence (& my eyes hurt)

Who is Participating?
the closing slash shows when i echo that line in php (php 5.0.4)

$star="<img src='images/star.gif' height='12px' width='12px' alt='someALT' />";
echo $star;

and it's there.  are you using HTMLtidy or something like it to redo your tags?
ARCglideAuthor Commented:
I am using Firefox v1.0.3... and viewing:

When I select some of the stars (eg. row5) - right click - 'view selected source' all the IMG and BR closing slashes are omitted!
However, when viewing full-page-source they are all present and correct.

Cool - all is proved good... thanX

I think that's a property of the parser in FireFox.
ARCglideAuthor Commented:
Not a huge issue - but seriously annoying when at the end of a bank-holiday weekend 'code-burn' the little things seemed to be going screwy.

You we're right - so you get the points!
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.