Can anyone tell me why this outputs a 31?
Posted: Wed Dec 14, 2005 3:40 pm
I have the following date picker, that I would like for the user to select from a drop box one of past 15 days. Then I want to use only the 'day' component to run some queries on it. For some reason, the result is always a 31, any ideas why?
<form action="Test.php" method="POST">
<select name="PickDate">
<input type=submit>
... and then the POST section in the next page .....
.... returns a 31, even though today is the 14th.
<form action="Test.php" method="POST">
<select name="PickDate">
Code: Select all
for ($i = 0; $i <= 15; $i++) {
$today = mktime (0,0,0,date("m") ,date("d")-$i ,date("Y"));
$option=date("D M j, Y",$today);
$value=date("m:d:Y",$today);
echo "<option value=\"$value\" $selected>$option</option>\n";
}... and then the POST section in the next page .....
Code: Select all
$PickDay = date("d", $_POST['PickDate']);
echo $PickDay;.... returns a 31, even though today is the 14th.