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