function newCategory() { $results = array(); $results['pageTitle'] = "New Article Category"; $results['formAction'] = "newCategory"; if (isset($_POST['saveChanges'])) { // User has posted the category edit form: save the new category $category = new Category(); $category->storeFormValues($_POST); $category->insert(); header("Location: admin.php?action=listCategories&status=changesSaved"); } elseif (isset($_POST['cancel'])) { // User has cancelled their edits: return to the category list header("Location: admin.php?action=listCategories"); } else { // User has not posted the category edit form yet: display the form $results['category'] = new Category(); require TEMPLATE_PATH . "/admin/editCategory.php"; } }
function newCategory() { $results = array(); $results['pageTitle'] = "New Article Category"; $results['formAction'] = "newCategory"; if (isset($_POST['saveChanges'])) { $category = new Category(); $category->storeFormValues($_POST); $category->insert(); header("Location: admin.php?action=listCategories&status=changesSaved"); } elseif (isset($_POST['cancel'])) { header("Location: admin.php?action=listCategories"); } else { $results['category'] = new Category(); require TEMPLATE_PATH . "/admin/editCategory.php"; } }