$email = $_POST['email']; $res = $empService->addEmp($name, $grade, $email); if ($res == 1) { //成功 header("location: ok.php"); exit; } else { //失败 header("location: error.php"); exit; } } else { if ($flag == "updateEmp") { $id = $_POST['id']; $name = $_POST['name']; $grade = $_POST['grade']; $email = $_POST['email']; $res = $empService->updateEmpUI($id, $name, $grade, $email); if ($res == 1) { //成功 header("location: ok.php"); exit; } else { //失败 header("location: error.php"); exit; } } } } }