Page 1 of 1

Dynamic image loading?

Posted: Fri Aug 22, 2008 6:10 pm
by bhtp
Hi, Im using a geolocation database which outputs the countries name and a two letter country code. I would like to load the according country flag the country flags correspond to the two letters. Like Canada is CA and its image is ca.png. I would like to dynamically load the image. The two letters are a variable. Can i do this in php?

Re: Dynamic image loading?

Posted: Fri Aug 22, 2008 6:17 pm
by Christopher

Code: Select all

<img src="images/<?php echo $country; ?>.png"/>
Or:

Code: Select all

echo "<img src=\"images/$country.png\"/>";

Re: Dynamic image loading?

Posted: Fri Aug 22, 2008 6:40 pm
by bhtp
thankyou