I just happen to have this function which you might find helpful:
/**
* This routine can take two strings representing dates
* and return the number of days that have elapsed between
* the two. By default, it rounds to the nearest day.
* NOTE: It relies on the strtotime() function to parse
* the date strings
* @param string $time1 The starting time
* @param string $time2 The ending time
* @param int $precision Round to this number of decimal points
* @return float The number of days between time 1 and time 2
*/
function get_days_elapsed($time1, $time2, $precision=0) {
$t1 = strtotime($time1);
if ($t1 === FALSE) return FALSE;
$t2 = strtotime($time2);
if ($t2 === FALSE) return FALSE;
$elapsed_seconds = $t2 - $t1;
$elapsed_days = round(($elapsed_seconds) / (60*60*24), $precision);
return $elapsed_days;
}
You could try something like this:
$current_date = date('Y-m-d');
$future_date = $_POST['future_date']; // this assumes you have an input in your form named future_date and your form has method="post"
$days_elapsed = get_days_elapsed($current_date, $future_date);