/** * function to check if the correct information is inputted * within the add fire fighter form and then is inserted * into the Alphabit Soup database * * @return function addFirefighterForm if there is a field missing or * function insertFirefighter if all information is correct */ function processFirefighter() { $fieldMissing = false; foreach ($_POST as $key => $value) { if ($value == null) { $_POST[$key] = "!missing!"; $fieldMissing = true; } } if ($fieldMissing) { return addFirefighterForm(); } else { return insertFirefighter(); } }
$successfulFirefighterInsert = executeQueryString($queryString); return "Firefighter:<br> FirstName:" . $firstName . "<br> Last Name: " . $lastName . "<br>Successful:" . $successfulFirefighterInsert . "<br><br>"; } function isValidFiremanId($id) { return true; } function isValidTimeslotId($id) { return true; } function isDateTime($dateTime) { return true; } $id = $_REQUEST["id"]; if ($id == "0") { $firefighter_json = $_REQUEST["firefighter_json"]; $firefighter = Firefighter::getFirefighterFromJson($firefighter_json); $fname = $firefighter->getFirstName(); $lname = $firefighter->getLastName(); $email = $firefighter->getEmail(); $phone = $firefighter->getPhone(); $secondaryPhone = $firefighter->getSecondaryPhone(); $carrier = $firefighter->getCarrier(); echo insertFirefighter($fname, $lname, $email, $phone, $secondaryPhone, $carrier); } else { $schedule_timeslot_json = $_REQUEST["schedule_timeslot_json"]; $schedule_timeslot = ScheduleTimeslot::getScheduleTimeslotFromJson($schedule_timeslot_json); echo insertScheduleTimeslot($schedule_timeslot); }