Jump to content
Updating IPB tonight Read more... ×

Archived

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

christine75

Help Inserting an image in an if statement

Recommended Posts

Hi everyone,

It's my first time here in on this forum [img src=\"style_emoticons/[#EMO_DIR#]/smile.gif\" style=\"vertical-align:middle\" emoid=\":smile:\" border=\"0\" alt=\"smile.gif\" /]

I'm having a problem inserting a image in my if statment. A little background, this statement below checks to see if my friend is online, if she is, then it is suppose to show an image of a star beside her name.

Right now, the statement is written like this below. When she's online, it echos/prints a * beside her name.

<?if ($friend[online]) echo "*";?>

I want to modify it so that when she's online, instead of the *, I want a picture of a star (length 16 by width 16). I tried to insert the statement below but I got an error [img src=\"style_emoticons/[#EMO_DIR#]/huh.gif\" style=\"vertical-align:middle\" emoid=\":huh:\" border=\"0\" alt=\"huh.gif\" /]


<?if ($friend[online]) img src "images/star.gif" length="16" width ="16";?>

As you can tell, I'm a newbie when it comes to php, can anyone help me and tell me how the statement should be written.

Thanks in advance [img src=\"style_emoticons/[#EMO_DIR#]/wink.gif\" style=\"vertical-align:middle\" emoid=\":wink:\" border=\"0\" alt=\"wink.gif\" /]

Christine

Share this post


Link to post
Share on other sites
You will need to put whatever you want to display inside the echo() function.

[code]<?if ($friend[online]) echo('<img src "images/star.gif" length="16" width ="16">');?>[/code]

[!--coloro:#990000--][span style=\"color:#990000\"][!--/coloro--]Jeremy[!--colorc--][/span][!--/colorc--]

Share this post


Link to post
Share on other sites
have you tried:
<?
if ($friend[online])
{
print "<img src='images/star.gif' length='16' width='16'>";
}
?>

Share this post


Link to post
Share on other sites

×

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.