Jump to content

Please Help - Echo Statements During Particular Dates And Times


bgareth

Recommended Posts

Hello,

 

I can't achieve what I am looking to do here:

 

 

<html>
<head>
<title>PHP Weekend Challenge</title>
</head>
<body>
<?php
\\*if month = december and day = 23rd and time=19:00-23:59 echo "Good Evening, tomorrow is Christmas Eve!"
or if month = december and day = 24th and time=19:00-23:59 echo "Good Evening, tomorrow is Christmas Day!"
else echo "It's not Christmas so too bad - it's just another 7 day working week!"*\\
?>
</body>
</html>

 

I'm a newbie so please assume I know nothing about PHP and provide as much explanation as you can for the solutions you give. I have read around on different websites and I find it exceptionally difficult to understand them because of my dyslexia and dyscalculia.

 

Please advise :-)

 

Thanks and Kind Regards,

 

Beanie

Hello,

 

I can't achieve what I am looking to do here:

 

 

<html>
<head>
<title>PHP Weekend Challenge</title>
</head>
<body>
<?php
\\*if month = december and day = 23rd and time=19:00-23:59 echo "Good Evening, tomorrow is Christmas Eve!"
or if month = december and day = 24th and time=19:00-23:59 echo "Good Evening, tomorrow is Christmas Day!"
else echo "It's not Christmas so too bad - it's just another 7 day working week!"*\\
?>
</body>
</html>

 

I'm a newbie so please assume I know nothing about PHP and provide as much explanation as you can for the solutions you give. I have read around on different websites and I find it exceptionally difficult to understand them because of my dyslexia and dyscalculia.

 

Please advise :-)

 

Thanks and Kind Regards,

 

Beanie

 

If you know literally nothing of PHP, you're gonna have a hard time understanding the answers that you get given here.

 

Assign a variable to the current date, then use if() to echo something when it's a certain date, or whatever.

 

Example:

 

<?php
$date = date(); //Put your date format in the parenthesis

if ($date="") { //Again, where the quotes are, put what date you need it to be to echo whatever you need it to
echo "Merry Generic Holiday!";
} elseif ($date="") {
echo "Happy other Generic Holiday";
} else {
echo "It's a normal day, have fun with your mediocre life";
}
?>

 

Or something. You can learn about date formats on PHP.net

<?php
if ($date="") { //Again, where the quotes are, put what date you need it to be to echo whatever you need it to
?>

 

Note: this will assign whatever is between the quotes to $date. Use "==" instead:

http://php.net/manual/en/language.operators.comparison.php

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.