The $to_date and $from_date variables were incorrectly referenced as $form_to_date and $form_from_date.