I am a novice PHP coder, just started learning.
I am trying to display a message on my webpage that should be triggered by a date check. The code is below (I removed all HTML tags for simplicity for now):
<?php
$m=date("m");
$d=date("d");
$y=date("Y");
$int_d = (int)$d;
//Thanksgiving
if ($m="11"&&$y="2010"&&$int_d>23&&$int_d<=28)
{
echo 'Happy Thanksgiving!';
}
//Holidays
if ($m="12"&&$y="2010"&&$int_d>=18&&$int_d<=31)
{
echo 'Happy Holidays!';
}
?>
I want each statement to be executed during the appropriate dates i.e. "Happy Thanksgiving" from 11/24/2010 to 11/28/2010, and "Happy Holidays" from 12/18/2010 to 12/31/2010.
The problem is that both statement are being executed regardless of the date conditions I use?
Thoughts?
Thanks