日付を比較するコードをいくつか書きますが、ここで問題が発生しました正しい場合もあれば、間違っている場合もあります。この問題を解決するにはどうすればよいですか?
<?php
$month = 2;
$year = 2012;
$saturday = strtotime('First Saturday '.date('F o', mktime(0,0,0, $month, 1, $year)));
echo date('Y/M/d', $saturday);
$sat1 = strtotime($saturday);
echo "<br/>";
$season1 = strtotime ( '+12 week' , $saturday);
$season2= date ( 'Y/M/d' , $season1 );
echo $season2;
$season = strtotime($season1);
echo "<br/>";
$date = $_POST["date"];
echo $date;
$date1 = strtotime($date);
echo "<br/>";
$abc = strtotime ('+1 week' , $season1);
$abc = date ('Y/M/d', $abc);
echo "<br/>";
echo $abc;
$abc1 = strtotime($abc);
if ($date1 <= $abc1)
{
if ($date1 <= $season)
{
echo "League already opened";
}
else if($date1 > $season)
{
echo "league successfully closed";
}
}
else
{
echo "league 1 closed";
}
if(!isset($POST['submit'])) {
?>
<form method="post" action=" ">
<label>enter date in YYYY/MM/DD format</label>
<input type="text" name="date" size="10" />
<input type="submit" value="submit" name="submit">
</form>
<?
}
?>
出力では、フォームを送信する前に if condition.before のメッセージが表示されます