if (!isset($_POST['User_Type'])) { $errors[] = "User type is required"; } else { $User_Type = $_POST['User_Type']; } if ($admin_controller->User_Name_Exists($User_Name)) { admin_redirect_error(Error_Type::SAME_USER_NAME); } if (empty($errors)) { /** * instantiate a new user */ $new_user = new User($User_Name, $User_Password, $User_Type, $User_Phone); /** * add the user to the database */ $added = $admin_controller->Add_User($new_user); /** * inform the admin about the result */ if ($added) { admin_redirect_success($new_user); } else { admin_redirect_error(Error_Type::DATA_BASE); } } else { admin_redirect_error(Error_Type::FORM); } } } }