Can someone help with this. I have a date which is being posted by another page. My dates look ok when they are together, but when I try to break them up into components, then it reverts back to today's current date.
First take a look at the posting page which creates a drop down list to select fom the last several days:
Code: Select all
<form action="test.php" method="POST">
<select name="PickDate">
<?
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";
}
?>
<input type=submit>The result looks like the following: (Say I selected Dec. 31, 2005 from the list and today is Jan. 3, 2006)
Code: Select all
$Postvalue = $_POST['PickDate'];
echo $Postvalue;
echo "</br>";
$PickDay = date ("d", strtotime($Postvalue));
$PickMonth = date("m", strtotime($_POST['PickDate']));
$PickYear = date("Y", strtotime($_POST['PickDate']));
echo $PickDay;
echo "</br>";
echo $PickMonth;
echo "</br>";
echo $PickYear;
echo "</br>";This outputs the following:
12:31:2005
03
01
2006
Any ideas?
Thanks,
Justin