$idlist .= ", " . \util\Misc::cleanCSV($txt);
        } else {
            $idlist = \util\Misc::cleanCSV($txt);
        }
    }
    $idtype = $_POST['idtype'];
    $outputFormat = $_POST['outputFormat'];
    $params['idtype'] = $idtype;
    $params['outputFormat'] = $outputFormat;
    $params['hideunique'] = isset($_POST['hide_unique']) ? 1 : 0;
    if (trim($idlist) == "") {
        $params['errormsg'] = "Cannot submit without IDs!";
        echo \html\FormPanel::makeHiddenForm("CSVForm", "index.php", $params);
    } else {
        $params = array('idlist' => $idlist, 'idtype' => $idtype, 'outputFormat' => $outputFormat, 'hideunique' => isset($_POST['hideunique']) ? 1 : 0);
        echo \html\FormPanel::makeHiddenForm("CSVForm", "process.php", $params);
    }
} else {
    $form = new \html\FormPanel("WorldCat Similar Titles Search", "form-panel", 'md-10', "form-horizontal", "");
    if (isset($_POST['errormsg'])) {
        $form->error($_POST['errormsg']);
    }
    $form->select('idtype', 'ID Type', true, array('isbn' => 'ISBN Numbers', 'issn' => 'ISSN Numbers'))->select('outputFormat', 'Output Format', true, array('html' => 'HTML', 'xml' => 'XML'))->file('idlist_file', 'Import IDs (CSV or line breaks)')->textarea('idlist_textarea', 'ID List (CSV or line breaks)')->checkbox("hideunique", "Ignore entries w/o related titles")->button('submit', 'Submit', 'btn btn-primary');
    $container = new \html\GridDiv("container");
    $container->row()->column('md-1')->column('md-10', null, $form->html())->column('md-1');
    echo $container->html();
}
?>
</body>
</html>