|
|
A nice simple welcoming script could be used for companies or w/e
[php]<html>
<body>
<?php
$d=date("D");
if ($d=="Sun")
echo "Have a nice Sunday!";
elseif ($d=="Mon")
echo "Have a nice Monday!";
elseif ($d=="Tue")
echo "Have a nice Tuesday!";
elseif ($d=="Wed")
echo "Have a nice Wednesday!";
elseif ($d=="Thu")
echo "Have a nice Thursday!";
elseif ($d=="Fri")
echo "Have a nice Friday!";
elseif ($d=="Sat")
echo "Have a nice Saturday!";
?>
</body>
</html>[/php]
I've used a tutorial for making thisbut i learnt something from it
(else if statements - date thing)
[PHP]<?php
$d=date("D");
switch ($d) {
case "mon":
echo "";
break;
case "tue":
echo "";
break;
case "wed":
echo "";
break;
case "thu":
echo "";
break;
case "fri":
echo "";
break;
case "sat":
echo "";
break;
case "sun":
echo "";
break;
default:
echo "lulwut?";
break;
}
?> [/PHP]
its better then over using the if and else and elseif lol how long you been learning for
Lol cookie monsta it wouldn't work.
You have $d as the date, And the in the switch you have $date.
[PHP]<?php
$d=date("D");
switch ($d) {
case "mon":
case "tue":
case "wed":
case "thu":
case "fri":
case "sat":
case "sun":
echo "";
break;
default:
echo "lulwut?";
break;
}
?>[/PHP]
You obviously haven't learned about passing one case onto the next if you're going to do the same snippet of code for two or more of the same cases.![]()
| « Beginners Guide | PHP Record Login Scripting » |
| Thread Information |
Users Browsing this ThreadThere are currently 1 users browsing this thread. (0 members and 1 guests) |