} if (isset($_POST['Purchase'])) { $validator = new FormValidator(); $validator->addValidation("firstName", "alpha", "Please fill only aplphabets for first name"); $validator->addValidation("firstName", "req", "Please fill in first name"); $validator->addValidation("lastName", "req", "Please fill in last name"); $validator->addValidation("lastName", "alpha", "Please fill only alphabets for last name"); $validator->addValidation("age", "req", "Please fill in phone number"); $validator->addValidation("age", "numeric", "Please fill only numeric values for phone number"); if ($validator->ValidateForm()) { $_SESSION['action'] = "purchaseTicket"; $var = $_SESSION['userMiles'] + $flightDetails->getFlightMiles(); $_SESSION['userMiles'] = $var; $_SESSION['modeOfPayment'] = $_REQUEST['modeOfPayment']; $passenger = new Passenger(); $passenger->setage($_REQUEST['age']); $passenger->setfname($_REQUEST['firstName']); $passenger->setlname($_REQUEST['lastName']); $_SESSION['passengerDetails'] = serialize($passenger); header("Location: ../controller/Controller.php"); } else { echo "<B>Validation Errors:</B>"; $error_hash = $validator->GetErrors(); foreach ($error_hash as $inpname => $inp_err) { echo "<p>{$inpname} : {$inp_err}</p>\n"; } } } $disp_firstName = isset($_POST['firstName']) ? $_POST['firstName'] : ''; $disp_lastName = isset($_POST['lastName']) ? $_POST['lastName'] : ''; $disp_age = isset($_POST['age']) ? $_POST['age'] : '';