public function deleteCategoryAction() { if ($this->request->isPost()) { Category::DeleteCategory($this->request->getPost('id')); header('Location: index'); } }
public function DeleteCat() { $cat_obj = new Category(); $id = Input::All(); if ($cat_obj->DeleteCategory($id)) { return Redirect::to('admin/listcat')->with('bao_thanh_cong', 'Xóa Thành Công'); } else { return Redirect::back()->with('bao_loi', 'Xóa Thất Bại'); } }
<?php include '../../connection.php'; include '../class/categories.php'; include '../class/room.php'; if (isset($_GET['categoryname'])) { $categoryname = $_GET['categoryname']; if (!Category::CAtegoryEmpty($categoryname)) { echo '<script type="text/javascript">'; echo 'alert("This Category has still rooms. please delete all rooms before removing the Category");'; echo 'window.location.href = "manageroom.php";'; echo '</script>'; } else { $Category = new Category(Category::GetCategoryID($categoryname), $categoryname); if ($Category->DeleteCategory()) { echo "success"; header('Location: manageroom.php'); } } }