}
 if (isset($_POST["description"])) {
     $description = htmlspecialchars($_POST["description"]);
 }
 if (isset($_POST["max_attendance"])) {
     $max_attendance = htmlspecialchars($_POST["max_attendance"]);
 }
 // set up event object
 $event = new Event();
 $event->setTitle($title);
 $event->setDate($date);
 $event->setStartTime($start_time);
 $event->setEndTime($end_time);
 $event->setLocation($location);
 $event->setDescription($description);
 $event->setMaxAttendance($max_attendance);
 $event->setCreatorUserId($_SESSION['uid']);
 $failure_messages = array();
 if (!$event->validate()) {
     foreach ($event->getValidationFailures() as $failure) {
         $message = '<p><strong>Error in ' . $failure->getPropertyPath() . ' field!</strong> ' . $failure->getMessage() . '</p>';
         array_push($failure_messages, $message);
         // clear out the bad data
         $_POST[$failure->getPropertyPath()] = '';
     }
     unset($message);
 } else {
     // validate date fields
     //$now = new DateTime('now');
     $st = DateTime::createFromFormat("m/d/Y H:i A", $date . " " . $start_time);
     $et = DateTime::createFromFormat("m/d/Y H:i A", $date . " " . $end_time);