Change the Background Daily based on computer Date | Sanwebcorner

Change the Background Daily based on computer Date

In this post i am going to explain about how to change the background color of the web page Daily based on computer Date using php script.

Here 'l' refers the day, i am using here switch case , You can use if else statement also, This is one of the Interesting thing in php to change the background every day automatically.

This is one of the simple method, This concept will be used for some time in websites and also its very interesting and funny  to see the different colors in web pages daily.


index.php:

<html>
<?php
$day=Date("l");
echo "<h1>Today is"." ".$day;
switch($day)
{
case 'Monday':
echo "<body bgcolor='Red'>";
break;

case 'Tuesday':
echo "<body bgcolor='yellow'>";
break;

case 'Wednesday':
echo "<body bgcolor='blue'>";
break;

case 'Thursday':
echo "<body bgcolor='green'>";
break;

case 'Friday':
echo "<body bgcolor='pink'>";
break;

case 'Saturday':
echo "<body bgcolor='orange'>";
break;

case 'Sunday':
echo "<body bgcolor='Purple'>";
break;

}
?>
</body>
</html>