Jump to content


Photo

Help Inserting an image in an if statement


  • Please log in to reply
2 replies to this topic

#1 christine75

christine75
  • New Members
  • Pip
  • Newbie
  • 1 posts

Posted 11 June 2006 - 07:28 AM

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

#2 jeremywesselman

jeremywesselman
  • Members
  • PipPipPip
  • Advanced Member
  • 154 posts
  • LocationIndependence, KY

Posted 11 June 2006 - 08:24 AM

You will need to put whatever you want to display inside the echo() function.

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

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

#3 adyre

adyre
  • Members
  • Pip
  • Newbie
  • 8 posts

Posted 11 June 2006 - 11:12 AM

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





0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users