Esempio n. 1
0
<?php

if ($_POST['action'] == "save") {
    if (empty($_POST['id'])) {
        $res = CategoriaController::insert($_POST);
        if ($res) {
            header("Location: blog-categorias");
            exit;
        } else {
            die("ERRO");
        }
    } else {
        $res = CategoriaController::update($_POST);
        if ($res) {
            header("Location: blog-categorias");
            exit;
        } else {
            die("ERRO");
        }
    }
} elseif ($_POST['action'] == "del") {
    if (CategoriaController::delete($_POST['id'])) {
        die("OK");
    } else {
        die("ERRO");
    }
}