$countErrors = 0;
    // Check Category Name
    if (trim($_POST['catname']) == "") {
        $countErrors++;
        $dispError .= "&nbsp;&nbsp;&nbsp;<b>&middot;</b> You must enter a Category Name.<br>";
    }
    // Check Category Order
    $intNewOrderSpot = $profileCatObj->validateOrder($_POST['catorder'], $_POST['beforeafter']);
    if ($intNewOrderSpot === false) {
        $countErrors++;
        $dispError .= "&nbsp;&nbsp;&nbsp;<b>&middot;</b> You selected an invalid category order.<br>";
    }
    if ($countErrors == 0) {
        $arrColumns = array("name", "ordernum");
        $arrValues = array($_POST['catname'], $intNewOrderSpot);
        if ($profileCatObj->addNew($arrColumns, $arrValues)) {
            $profileCatInfo = $profileCatObj->get_info_filtered();
            echo "\n\t\t\t<div style='display: none' id='successBox'>\n\t\t\t\t<p align='center'>\n\t\t\t\t\tSuccessfully Added New Profile Category: <b>" . $profileCatInfo['name'] . "</b>!\n\t\t\t\t</p>\n\t\t\t</div>\n\t\t\t\n\t\t\t<script type='text/javascript'>\n\t\t\t\tpopupDialog('Add Profile Category', '" . $MAIN_ROOT . "members', 'successBox');\n\t\t\t</script>\n\t\t\t";
        } else {
            $countErrors++;
            $dispError .= "&nbsp;&nbsp;&nbsp;<b>&middot;</b> Unable to save category to the database.  Please contact the website administrator.<br>";
        }
    }
    if ($countErrors > 0) {
        $_POST = filterArray($_POST);
        $_POST['submit'] = false;
    }
}
if (!$_POST['submit']) {
    $countCategories = 0;
    $result = $mysqli->query("SELECT * FROM " . $dbprefix . "profilecategory ORDER BY ordernum DESC");