Hello Jason,
Friday, March 5, 2004, 1:51:57 PM, you wrote:
JB> Hello, I am new to using the date function. I am in the need of a
JB> script that changes an image on a web page on the first day of each
JB> month and keeps the image there until the first day of the next month.
JB> I have tried to look for something that could come close but still
JB> didn�t work. Can you please help me? I have a picture of a friend of
JB> mine that wants on her site a picture of her with a different colored
JB> suit depending on the month. Example: February = Love color=red Any
JB> help will be greatly appreciated.
It might be easier to think about this from a different viewpoint -
instead of worrying about changing an image based on the day of the
month, you could instead have a directory full of images for each
month of the year, i.e.:
graphics/2004/1.jpg
graphics/2004/2.jpg
graphics/2004/3.jpg
(etc)
1 = January, 2 = February, you get the idea.
Then to display the correct one on your site all you would need is:
<?php
$month = date("n");
echo "<img src=\"graphics/2004/$month.jpg\">";
?>
Or from within your HTML:
<img src="graphics/2004/<?=date("n")?>.jpg">
--
Best regards,
Richard Davey
http://www.phpcommunity.org/wiki/296.html
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php