christine75 Posted June 11, 2006 Share Posted June 11, 2006 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 Link to comment https://forums.phpfreaks.com/topic/11694-help-inserting-an-image-in-an-if-statement/ Share on other sites More sharing options...
jeremywesselman Posted June 11, 2006 Share Posted June 11, 2006 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--] Link to comment https://forums.phpfreaks.com/topic/11694-help-inserting-an-image-in-an-if-statement/#findComment-44212 Share on other sites More sharing options...
adyre Posted June 11, 2006 Share Posted June 11, 2006 have you tried:<?if ($friend[online]) {print "<img src='images/star.gif' length='16' width='16'>";}?> Link to comment https://forums.phpfreaks.com/topic/11694-help-inserting-an-image-in-an-if-statement/#findComment-44237 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.