All PHP Tutorials
Ad Management
Counter
Email System
Forum and Guestbook
File Upload
Image Manipulation
Login / Members / Password
Pagination
Encode Script
Refresh / Redirection
Miscellaneous
All MySQL Tutorials
Create, Manage Database using phpMyAdmin
Connect to Database
Insert Data
Select Data
Edit Database
Update Database
Delete Database
Order Results
Forums



Home > PHP Tutorials
PHP Script Image of the day
PHP Script Image of the day
In this script shows you how to display image of the day. You can adapt this script to display quote of the day, knowledge of the day or something else you want. You don't have to change image everyday just change images once a week. 
 
  Images - Right click to save images or download here (Zip file 91.8 KB)
 

  What to do?

1. Find what today is? using date function and keep answer in variable name "$today".
2. Compare $today with name of the day.
3. Display "Today is " ... " and display image of the day.
4. test it. Try to change your machine date and see the result!

$today=date(l); // Find what today is? using date function

// If today is Monday displays message "Today is Monday" and displays image1.gif
if($today==Monday){
// Compare $today with name of the day.
echo "Today is Monday";
echo "<BR>";
// Line break
echo "<img src='images/image1.gif'>";
// images keep in forder "images"
}

-----------------------------------------------------------------------------------------------------------------

If You want to show 1 month 31 images replace with this code

$today=date(d); // display date "01", "02", "03"..."15", "16" ....
if($today==01){ .......

elseif($today==15){ .......

until $today==31


  ############### Code

<?
$today=date(l);
// Find what today is? using date function

if($today==Monday){
echo "Today is Monday";
echo "<BR>";
echo "<img src='images/image1.gif'>";
}

elseif($today==Tuesday){
echo "Today is Tuesday";
echo "<BR>";
echo "<img src='images/image2.gif'>";
}

elseif($today==Wednesday){
echo "Today is Wednesday";
echo "<BR>";
echo "<img src='images/image3.gif'>";
}

elseif($today==Thursday){
echo "Today is Thursday";
echo "<BR>";
echo "<img src='images/image4.gif'>";
}

elseif($today==Friday){
echo "Today is Friday";
echo "<BR>";
echo "<img src='images/image5.gif'>";
}

elseif($today==Saturday){
echo "Today is Saturday";
echo "<BR>";
echo "<img src='images/image6.gif'>";
}

elseif($today==Sunday){
echo "Today is Sunday";
echo "<BR>";
echo "<img src='images/image7.gif'>";
}

?>

Random Tutorial
 
Form Validation Using Dreamweaver
In this tutorial shows you how to validate form using Macromedia Dreamweaver, it will show alert box when someone press submit button and forgot to fill your requied fields.
 
Limit Displayed Characters From Your Text
This php script helps you limit displaying characters form you message and not cut out your word.
 
   
Hosted by Hostgator
© PHPeasystep.com 2005-2008