While i speaking with one of my favorite client. He asked me for new concept which never caught in my mind i.e., changing background color automatically. First i think this concept very logically but it come to conclusion with simple coding.
<?php
$background_color = ‘#000000′;
switch(date(‘md’)) {
case 1112: //this color will be set as background on 11th month and date 12
$background_color = ‘#990033′;
break;
case 1123: //this color will be set as background on 11th month and date 23
$background_color = ‘#0000FF’;
break;
case 1012: //this color will be set as background on 10th month and date 12
$background_color = ‘#0000FF’;
break;
}
?>
<!DOCTYPE html PUBLIC “-//W3C//DTD XHTML 1.0 Transitional//EN” “http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd”>
<html xmlns=”http://www.w3.org/1999/xhtml”>
<head>
<meta http-equiv=”Content-Type” content=”text/html; charset=iso-8859-1″ />
<title>Easy changing background color automatically using PHP</title>
</head>
<body bgcolor=’<?php echo($background_color);?>’>
</body>
</html>



Posted in
Tags: