anilm Posted November 21, 2013 Share Posted November 21, 2013 Hi I need to replace country abbreviations with the appropriate country flag. The php line on the website is a call from an ebay api: print "<h5>".$item["COUNTRY"]."</h5>"; so, if the country is Spain, the result ES is printed I have an image folder with all the countries flags, and this particular case, it is called ES.png. There is also a mySql database in the format: ID, name,abbr (in this case: 1,Spain,ES) Is there an easy way to do this dynamically? Thanks Link to comment https://forums.phpfreaks.com/topic/284140-replace-text-with-flag/ Share on other sites More sharing options...
Ch0cu3r Posted November 21, 2013 Share Posted November 21, 2013 Output $item["COUNTRY] into the image path echo '<img src="path/to/country/images/'.$item['COUNTRY'].'.png" />'; You can do he same thing for when you get the country code out of the database too. Link to comment https://forums.phpfreaks.com/topic/284140-replace-text-with-flag/#findComment-1459397 Share on other sites More sharing options...
anilm Posted November 21, 2013 Author Share Posted November 21, 2013 Brilliant. Many thanks Link to comment https://forums.phpfreaks.com/topic/284140-replace-text-with-flag/#findComment-1459399 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.