function save_image($connection)
{
    $file = $_FILES["image"];
    $image_id = $_REQUEST['imageId'];
    $title = $_REQUEST['title'];
    $section_id = $_REQUEST['sectionId'];
    $file_path = basename($file["name"]);
    $connection->begin_transaction();
    if ($image_id > 0) {
        $old_image = get_image($connection, $id);
        if ($file_path != "" && $old_image != $file_path) {
            remove_image_file($old_image);
            do_file_move($file);
            $update_section_image_stmt = update_section_image_stmt($connection);
            $update_section_image_stmt->bind_param("ssi", $file_path, $title, $id);
            catch_execution_error($update_section_image_stmt->execute(), $connection);
        } else {
            $update_section_image_stmt = update_section_image_stmt($connection);
            $update_section_image_stmt->bind_param("ssi", $old_image, $title, $id);
            catch_execution_error($update_section_image_stmt->execute(), $connection);
        }
        print '[["SUCCESS"],["Image saved successfully"]]';
    } else {
        do_file_move($file);
        $next = get_next_order($connection, "section_to_image");
        $insert_section_image_stmt = insert_section_image_stmt($connection);
        $insert_section_image_stmt->bind_param("iiss", $section_id, $next, $file_path, $title);
        catch_execution_error($insert_section_image_stmt->execute(), $connection);
        print "[[\"SUCCESS\"],{\"id\": " . get_last_inserted_id($connection) . ", \"sectionId\": {$section_id}, \"title\": \"{$title}\", \"filePath\": \"{$file_path}\"}]";
    }
    $connection->commit();
}
    } else {
        $warning = $lang["msg_delete_KO"];
    }
}
//	modify item
if (isset($_POST["mod"])) {
    if (mod_item($this_table, $_POST["id"], $_POST["mod"])) {
        header("Location:index.php?page=" . ADMIN_PAGE . "&id_modified=" . $_POST["id"] . "&msg=mod_OK");
    } else {
        $warning = $lang["msg_mod_KO"];
    }
}
//	add new item
if (isset($_POST["add"])) {
    //	define next list order
    $_POST["add"]["list_order"] = get_next_order($this_table);
    $_POST["add"]["id_user"] = $_SESSION["admin_id"];
    if (add_item($this_table, $_POST["add"], false)) {
        header("Location:index.php?page=" . ADMIN_PAGE . "&id_added=" . mysql_insert_id() . "&msg=add_OK");
    } else {
        $warning = $lang["msg_add_KO"];
    }
}
if (isset($_REQUEST["action"])) {
    $xtra_moo .= '
	new FormCheck("item_form");
	';
    switch ($_REQUEST["action"]) {
        case "new":
            $page_title_add = ' - ' . $lang["title_add"];
            $contents .= '