开发者

Display an image from images folder if a value equals something

i have a little problem i need some help with. i have the following echo that displays a link to a help file:

echo "<h2>" . popup_help('help.php?popup=1&ship_info=1&shipno=' .
     $user_ship['shipclass'], 300, 600, $user_ship['ship_name']) ;

The above displays a link that leads to a help file pertaining the specific ship info, namely it displays the ship name.

shipclass is a number ex. 400.

how can i display an image from my images folder so i can have that image printed on the page directly?

something in th开发者_JAVA技巧e lines of;

if usership = 400 echo ship.png?

ive tried something in the lines of

if $user_ship['shipclass'] echo ship.png;

without luck.

Any ideas?

Thank you for reading.


Try to write <img> tag in the echo.

For example :

echo "<img src='/public/img/mail.png'/>";


If you have path of the image then

//$imagepath contains the path of img and img name
echo "<img src='".$imagepath."'/>";

in your case its

echo "<img src='shops/ship.png'/>"; 
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜