Jump to content

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

Edited by bgareth

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 by Manixat

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 by Beeeeney

<?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

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.