$student->set_id($_POST['id']); $student = $this->studentrepository->update($student); header("location:index.php?page=student&action=success"); } } public function delete() { $id = $_GET['id']; $this->studentrepository->delete($id); header("Location: index.php?page=student&action=delete"); } } if (isset($_GET['m'])) { $method = $_GET['m']; } else { $method = "index"; } $studentcontroller = new StudentController(); switch ($method) { case 'add': $studentcontroller->add(); break; case 'edit': $studentcontroller->edit(); break; case 'delete': $studentcontroller->delete(); break; default: $studentcontroller->index(); }