"Henri marc" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
> Hello,
>
> I would like to use a variable instead of an image
> file name in a html page with this instruction:
>
> <?php
> echo '<img src="$myimage">';
> ?>
>
> I tried but the image doesn't show up. Is it
> impossible or do I do something wrong?
> My goal is to have a random image print in the page,
> that's why I want to use a variable.
>
> Thank you for your good advices.

Variables in single-quoted strings are not evaluated. Either user double
quotes or concatination:

echo "<img src=\"$myimage\">"; or
echo '<img src="' . $myimage . '">';

Regards, Torsten Roehr

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to