Hi team!

I am feeding data into a database using a html form with date text input field. I don't want to enter the current date as what I am recording happened in the previous but I still need to calculate the number of days, months and years since the event occured. I have writen the following code to insert date into the database table:

$event_date=mysql_real_escape_string($_POST['date']);
$event_date=date('Y-m-d,strtotime($event_date));
$insert_date=maysql_query("insert into table_name(date_field)VALUES('$event_date')";
surpringly, the insert query is inserting 0000-00-00. The user is entering date in m-d-yyyy format. I have validated the user input date using the following

code:
$date_arr = explode('-', $event_date);
if (checkdate($date_arr[0], $date_arr[1], $date_arr[2])==false) {
// valid date ...
$errors[]="What you entered is not a valid date format";
}
the validation have worked fine.

This is my question: What is going wrong in that the query is inserting 0000-00-00 instead of the date value? When echo the $event_date before inserting into
the database is like is working fine. Any help please.thank you in advance.