[man]strtotime/man can convert most standard formats to a UNIX timestamp integer, which you can then pass to [man]date/man to get the desired format ("Y-m-d" for MySQL). Generally the surest way to get the user to enter the data in a usable "format" is to have separate fields for month, day, and year, and then "glue" them together, perhaps with [man]mktime/man or else the aforementioned strtotime(). You could also use [man]sprintf/man:
<?php
$month = (int) $_POST['month'];
$day = (int) $_POST['day'];
$year = (int) $_POST['year'];
if(checkdate($month, $day, $year) == false)
{
// error: invalid date.
}
else
{
$dbDate = sprintf("%04d-%02d-%02d", $year, $month, $day);
}
But if you just want/need to allow the user to enter a single date field:
$date = strtotime($_POST['date']);
if($date == 0)
{
// error: invalid date.
}
else
{
$dbDate = date('Y-m-d', $date);
}