$id = (int) $_GET['id'];
 }
 if (isset($_POST['id']) && is_numeric($_POST['id'])) {
     $id = (int) $_POST['id'];
 }
 if ($id <= 0) {
     $editor = new editor('entry_type', $_SERVER['PHP_SELF'] . '?editor=1');
     $editor->setHeading(__('New entrytype'));
     $editor->setSubmitTxt(__('Add'));
 } else {
     $editor = new editor('entry_type', $_SERVER['PHP_SELF'] . '?editor=1', $id);
     $editor->setHeading(__('Change entrytype'));
     $editor->setSubmitTxt(__('Change'));
 }
 $editor->setDBFieldID('entry_type_id');
 $editor->showID(TRUE);
 $editor->makeNewField('entry_type_name', __('Entrytype name'), 'text');
 $editor->makeNewField('entry_type_name_short', __('Short entrytype name'), 'text');
 $editor->makeNewField('resourcenum_length', _h('Length of resource number') . '<br />(' . _h('If zero, resource number will not be required') . ')', 'text');
 $editor->makeNewField('entry_type_inactive', _l('Inactive'), 'select');
 $editor->addChoice('entry_type_inactive', 0, _l('No'));
 $editor->addChoice('entry_type_inactive', 1, _l('Yes'));
 $editor->getDB();
 if (isset($_POST['editor_submit'])) {
     if ($editor->input($_POST)) {
         if ($editor->performDBquery()) {
             // Redirect
             header('Location: admin_entry_type.php');
             exit;
         } else {
             echo 'Error occured while performing query on database:<br>' . chr(10), exit;