PDA

View Full Version : html - display images using <img> but sources is php variable



mnbvcxz
December 31st, 2006, 02:32 PM
how do i put php variables into the images i want to display on html using the <img>

<img src="$imagename" />

:ko: thank you

evildrummer
December 31st, 2006, 02:48 PM
? still need help?
either:


<?php
echo ('<img src="'.$imagename'" />');
?>
or


<img src="<?php echo($imagename); ?>" />

evildrummer
December 31st, 2006, 02:49 PM
I think the first one is write

or a simple


<?php
echo("<img src=\"$imagename\" />");
?>

mnbvcxz
December 31st, 2006, 02:52 PM
thank you very much:snug:

nobody
December 31st, 2006, 06:19 PM
evildrummer, why do you wrap your echo in parenthesis?

Seb Hughes
January 1st, 2007, 10:34 AM
evildrummer, why do you wrap your echo in parenthesis?

I was thinking the exact same thing. :hugegrin:

deletedUser2352352
January 3rd, 2007, 06:16 AM
you could do this




<img src="<?php echo $imagename; ?>" alt="blah blah" />

or

<?php
echo '<img src="'.$imagename.'" alt="blah blah" />';
?>

Danii
January 3rd, 2007, 08:33 AM
<img src="<?=$imagename?>" alt="image"/>