I have the following code working fine with
echo '<img src = "adsphotos/myphoto.jpg" width="100" height="90" hspace="10" border="0" />';
Any one tell me how to replace "adsphotos/myphoto.jpg" by a variable like $filename and modify the coding?
It is not accepting :
$filename="adsphotos/myphoto.jpg";
echo '<img src = $filename width="100" height="90" hspace="10" border="0" />';
PHP coding. How to replace statement by variable?
Moderator: General Moderators
Re: PHP coding. How to replace statement by variable?
<?php
$filename="images.jpeg";
echo '<img src = '.$filename.' width="100" height="90" hspace="10" border="0" />';
?>
Can u try the above one....
$filename="images.jpeg";
echo '<img src = '.$filename.' width="100" height="90" hspace="10" border="0" />';
?>
Can u try the above one....
-
Mark Baker
- Forum Regular
- Posts: 710
- Joined: Thu Oct 30, 2008 6:24 pm
Re: PHP coding. How to replace statement by variable?
Slight fix yempee, quotes around the image src
Code: Select all
$filename="adsphotos/myphoto.jpg";
echo '<img src = "'.$filename.'" width="100" height="90" hspace="10" border="0" />';
Re: PHP coding. How to replace statement by variable?
Really appreciating your fast reply. This reduces my headache. I tried to get information on net but I could not. Thank you very much once again.
Re: PHP coding. How to replace statement by variable?
Gee and I thought this was the netazadms wrote:Really appreciating your fast reply. This reduces my headache. I tried to get information on net but I could not. Thank you very much once again.