<?php

function edit_item() {

}

function delete_item($conn) {
    try {
        $sql = "DELETE FROM barvy WHERE id=";
        $conn->exec($sql);
        echo "Záznam Smazán";
    }
}

function create_item() {
    # edit this function to work with an input
    $sql = "INSERT INTO barvy (id, barva) VALUES (NULL, $barva)"
}

switch ($_GET["action"]) {
    case "edit":
        edit_item();
    case "delete":
        delete_item();
    case "new":
        create_item();
    default:
        echo "vyber si nejakou moznost more";
}

?>