bgareth Posted November 16, 2012 Share Posted November 16, 2012 (edited) 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 Edited November 16, 2012 by bgareth Quote Link to comment https://forums.phpfreaks.com/topic/270771-please-help-echo-statements-during-particular-dates-and-times/ Share on other sites More sharing options...
Manixat Posted November 16, 2012 Share Posted November 16, 2012 (edited) all you need is to learn the if() syntax, perhaps the comparison operators, and date(). There's plenty of explanation and examples in the manuals I have given you, good luck! : ) Edited November 16, 2012 by Manixat Quote Link to comment https://forums.phpfreaks.com/topic/270771-please-help-echo-statements-during-particular-dates-and-times/#findComment-1392882 Share on other sites More sharing options...
Beeeeney Posted November 16, 2012 Share Posted November 16, 2012 (edited) 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 Edited November 16, 2012 by Beeeeney Quote Link to comment https://forums.phpfreaks.com/topic/270771-please-help-echo-statements-during-particular-dates-and-times/#findComment-1392887 Share on other sites More sharing options...
cyberRobot Posted November 16, 2012 Share Posted November 16, 2012 <?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 Quote Link to comment https://forums.phpfreaks.com/topic/270771-please-help-echo-statements-during-particular-dates-and-times/#findComment-1392944 Share on other sites More sharing options...
Beeeeney Posted November 16, 2012 Share Posted November 16, 2012 Note: this will assign whatever is between the quotes to $date. Use "==" instead: http://php.net/manua....comparison.php *Shoots self in face* Quote Link to comment https://forums.phpfreaks.com/topic/270771-please-help-echo-statements-during-particular-dates-and-times/#findComment-1392955 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.