----- Original Message -----
From: "brucewhealton"
Hello all,
I thought this would be very easy but I'm doing something
wrong here. I want to create a display of an image using a variable.
In static html it is
<img src="images/topbanner1.jpg" />
I want the topbanner to change depending on the month of the year.
So, I calculate that with this, easy enough:
<?php
$monthnum = data("n");
?>
I have six banners so I if $monthnum is greater than 6, I subtract 6.
This so far is very easy.
Now, I want to build up the image tag using the php values. So, I
have the following (this is just the part of the code for displaying
the image.
echo "<img src=\"images/topbanner";
echo $monthnum."jpg";
echo "\"/>";
I used the \ to escape the " on the first line where it should be
src="images/topbanner"
What's wrong here?
Thanks,
Bruce
------------------------------------
$number = 0 + date('n');
if($number > 6) {$number = $number - 6;}
echo('<img src="images/topbanner' . $number . '.jpg" />');
you were missing the . before jpg