A H A H - 4 months ago 15
PHP Question

How to pass a string from PHP into an html tag?

I have a string, an img url, in a php block called $str. And I want to set that string as the img src in an img src but its not working.

<img src="<?php $str ?>" height="50px" width="50px">


how else can i set the src to the $str string?

Answer
<img src="<?php echo $str;?>" height="50px" width="50px">