Esempio n. 1
0
            $sub_cat->name = $_POST['edit_sub_cat'];
            $sub_cat->updateSubName($id);
            echo "id=" . $id . " , name = " . $_POST['edit_sub_cat'];
            header("location:../controle.php");
        } else {
            $_SESSTION['error'] = "please enter a valid name";
            echo "error";
            header("location:../controle.php");
        }
        break;
    case 'editcatid':
        if (isset($_POST['sub_cat_id']) && !empty($_POST['sub_cat_id'])) {
            $sub_cat->cat_id = $_POST['sub_cat_id'];
            $sub_cat->updateCatId($id);
            echo "id=" . $id . " , updated with id = " . $_POST['sub_cat_id'];
            header("location:../controle.php");
        } else {
            $_SESSTION['error'] = "please enter a valid name";
            echo "error";
            header("location:../controle.php");
        }
        break;
    case 'delete':
        $sub_cat_id = $sub_cat->delete($id);
        echo "<br/>deleted id = " . $sub_cat_id;
        header("location:../controle.php");
        break;
    default:
        # code...
        break;
}