function ajax_sottocat()
{
    $macro = $_REQUEST["macro"];
    $suffisso = $_REQUEST["suffisso"];
    //query sulle sottocat
    $sottoCat = new Sottocategorie();
    $arrCat = $sottoCat->getAll(" and sc_fkcat=" . $macro . " order by sc_sorting");
    $num = count($arrCat);
    if ($num == 0) {
        print "- - <input type='hidden' name='sottocat" . $suffisso . "' id='sottocat" . $suffisso . "' value='0'> <script>ajaxProdotto('','" . $suffisso . "')</script>";
    } else {
        print "<select name='sottocat' id='sottocat" . $suffisso . "' class='select' ><option value=''></option>";
        foreach ($arrCat as $arr) {
            print "<option value='" . $arr["sc_id"] . "'";
            if (isset($_REQUEST["evidenza"]) && $_REQUEST["evidenza"] == $arr["sc_id"]) {
                print " selected";
            }
            print ">" . $arr["sc_sottocat"] . "</option>";
        }
        print "</select>";
    }
}
//controllo se si sta facendo un inserimento
if (isset($_POST["save"]) and $_POST["save"] == "si") {
    $fk_cat = $_POST["categoria"];
    $sottocategoria = $_POST["sottocategoria"];
    $sottocategoria_ita = $_POST["sottocategoria_ita"];
    $sottocategoria_ted = $_POST["sottocategoria_ted"];
    $pubblicato_eur = "f";
    $pubblicato_uk = "f";
    if (isset($_POST["pubblicato_eur"]) and $_POST["pubblicato_eur"] == "t") {
        $pubblicato_eur = "t";
    }
    if (isset($_POST["pubblicato_uk"]) and $_POST["pubblicato_uk"] == "t") {
        $pubblicato_uk = "t";
    }
    $object = new Sottocategorie();
    if (isset($_POST["insert"]) and $_POST["insert"] == "si") {
        $object->add($fk_cat, $sottocategoria, $sottocategoria_ita, $sottocategoria_ted, $pubblicato_eur, $pubblicato_uk);
        //recupero l'ultimo id inserito
        $db = new Db();
        $id = $db->get_last_id();
    } elseif (isset($_POST["update"]) and $_POST["update"] == "si") {
        $id = aggiusta_post($_GET["id"]);
        $object->update($id, $fk_cat, $sottocategoria, $sottocategoria_ita, $sottocategoria_ted, $pubblicato_eur, $pubblicato_uk);
        //upload dei file
        update_file("pr_sottocategoria", "sottocategorie_dettaglio.php?errore=file&id=" . $id, $id);
    }
    print "<script language='Javascript'>window.location.replace('sottocategorie_dettaglio.php?id=" . $id . "&ins=si');</script>";
}
$fkclasse = "";
$sottocategoria = "";