switch ($action) { case 'Guest Reservation': //if guest has not been selected exit // instantiate form validator object $fv = new formValidator(); //from functions.php if (empty($_POST["guestid"])) { //if no guest has been selected no point in displaying other errors $fv->validateEmpty('guestid', 'No guest has been selected for reservation.'); } else { $fv->validateEmpty('reservation_type', 'Please indicate if it\'s a Direct booking or Agent booking.'); $fv->validateEmpty('meal_plan', 'Please select Meal Plan'); $fv->validateEmpty('reserve_checkindate', 'Please enter checkin date for reservation'); $fv->validateEmpty('roomid', 'Please indicate room being booked'); } if ($fv->checkErrors()) { // display errors echo "<div align=\"center\">"; echo '<h2>Resubmit the form after correcting the following errors:</h2>'; echo $fv->displayErrors(); echo "</div>"; } else { $reserved_through = !empty($_POST["reservation_type"]) ? "'" . $_POST["reservation_type"] . "'" : 'NULL'; $guestid = $_POST["guestid"]; $reservation_by = !empty($_POST["reservation_by"]) ? "'" . $_POST["reservation_by"] . "'" : 'NULL'; $reservation_by_phone = !empty($_POST["reservation_by_phone"]) ? "'" . $_POST["reservation_by_phone"] . "'" : 'NULL'; $reserve_checkindate = !empty($_POST["reserve_checkindate"]) ? "'" . $_POST["reserve_checkindate"] . "'" : 'NULL'; $reserve_checkoutdate = !empty($_POST["reserve_checkoutdate"]) ? "'" . $_POST["reserve_checkoutdate"] . "'" : 'NULL'; $no_adults = !empty($_POST["no_adults"]) ? $_POST["no_adults"] : 'NULL'; $no_child0_5 = !empty($_POST["no_child0_5"]) ? $_POST["no_child0_5"] : 'NULL'; $no_child6_12 = !empty($_POST["no_child6_12"]) ? $_POST["no_child6_12"] : 'NULL';