Jump to content

php inside html


nightkarnation

Recommended Posts

Ok this is a fragment of the code...here i want to display an image with the value of location inside HTML code...that is coming from mysql query...

 

My doubt is...am i coding correctly the separation of: "<?='location'?>.jpg"

 

//...IRRELEVANT PHP CODE
?>
<img src="<?='location'?>.jpg" alt="USA" width="20" height="14" />
<?php
//...GO BACK TO MORE IRRELEVANT PHP CODE

 

Any ideas? Thanx in advance for the help!!

Cheers

Link to comment
https://forums.phpfreaks.com/topic/123548-php-inside-html/
Share on other sites

<?php

// Mysql query
$row = mysql_fetch_array($sql);
?>
<img src="<?= $row['location']; ?>.jpg" alt="USA" width="20" height="14" />

 

Its not working :(

 

This is the final output of the path:

http://localhost/Test/HtmlPhpMysql/%3C?= $row['location']; ?>.jpg

Instead of being:

http://localhost/Test/HtmlPhpMysql/Usa.jpg

Link to comment
https://forums.phpfreaks.com/topic/123548-php-inside-html/#findComment-638079
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.