I have a portal build in PHP mysql. There's a specific field with the country code value ie "351" in number format.
Can I use the var countrycode.jpg to open the respective file?
something like
$var = "351"
<img src=$var.jpg>
ps: i have a folder with all country codes in (number).jpg format
sorry my dumb question. Thanks in advance for any help. Cheers
CodePudding user response:
To use php inside html element use echo, something like
<img src="<?php echo $var ?>.jpg">
CodePudding user response:
The question is not very clear, but this is what I assume you want to achieve.
you want to show the image 351.jpg
and that actually exists on your server then you can show it like this.
$var = 351;
<img src="<?php echo $var; ?>.jpg ">