Hi,
I am using a javascript datepicker and below is the html form for the date fields
<input id="dateid1" type="text" size="25"><a href="javascript:NewCal('dateid1','MMDDYYYY')"><img src="datetimepick/cal.gif" width="16" height="16" border="0" alt="Select a date"></a>
I am using another php where I am passing this value
$date = $_POST['dateid1'];
Now I am not able to insert the selected to date into MySQL db (I am using date as the data type).
Here are methods that I've tried so far-
/####Inserts current date only
$date = $_POST['dateid1'];
$dateTime = new DateTime($date);
$formatted_date=date_format ( $dateTime, 'Y-m-d' );
echo $formatted_date;
/
/####Inserts 0000-00-00
$input = date('m-d-Y', $POST['dateid1']);
$d = explode('-', $POST['dateid1']);
$date = mktime(0,0,0,$d[0],$d[1],$d[2]);
echo $date;
/
/#### Inserts 1969-12-31
$input = $_POST["dateid1"];
$newdate = date("Y-m-d", strtotime($input));
echo $newdate;
/
Any help would be really appreciated.