Here is the code
Code: Select all
<?PHP
define("ADAY", (60*60*24));
if (!checkdate($_POST['month'],$_POST['mday'],$_POST['year'])) {
$nowArray = getdate();
$mday = $nowArray['mday'];
$mon = $nowArray['mon'];
$year = $nowArray['year'];
} else {
$mday = $_POST['mday'];
$mon = $_POST['month'];
$year = $_POST['year'];
}
$start = mktime (12,0,0, $month,$day,$yr);
$firstDayArray = getdate($start);
echo "
<form name=disp_events action=$_SERVER[PHP_SELF] method='post'>
<p align=\"center\">
<select name=\"day\">";
$days=Array(1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31);
for ($x=1; $x <= count($days); $x++) {
echo"<option value=\"$x\"";
if ($x == $day) {
echo " SELECTED";
}
echo ">".$days[$x-1]."";
}
echo "</select>
<select name=\"month\">";
$months=Array("January", "February", "March", "April", "May",
"June", "July", "August", "September", "October", "November", "December");
for ($x=1; $x <= count($months); $x++) {
echo"<option value=\"$x\"";
if ($x == $month) {
echo " SELECTED";
}
echo ">".$months[$x-1]."";
}
echo "</select>
<select name=\"year\">";
for ($x=2006; $x <= 2015; $x++) {
echo"<option";
if ($x == $year) {
echo " SELECTED";
}
echo ">$x";
}
echo "</select>
<input type=\"submit\" value=\"Go!\"></p>";
$month=sprintf("%02d",$month);
$day=sprintf("%02d",$day);
if ($month=="00") {
$nowArray=getdate();
$month=$nowArray['mon'];
$yr=$nowArray['year'];
$day=$nowArray['mday'];
echo "no date<br>";
}
echo "Day: $day<br>";
echo "Month: $month<br>";
echo "Year: $year<br>";
$newdate="$year-$month-$day";
?>