Location: PHPKode > projects > NOLA > admindocmgmtcatupd.php
<? include('includes/main.php'); ?>
<?
	echo texttitle(STR_DOCUMENT_MANAGER_CATEGORY_UPDATE);
	if ($id) { // if the user has submitted info
		if ($delete) { //if we should be deleting the entry
			$conn->Execute('delete from docmgmtcategory where id='.sqlprep($id));
			die(textsuccess(STR_CATEGORY_DELETED_SUCCESSFULLY));
		} elseif ($name) { //if we should update the entry
			$conn->Execute('update docmgmtcategory set name='.sqlprep($name).' where id='.sqlprep($id));
			echo textsuccess(STR_CATEGORY_UPDATED_SUCCESSFULLY);
		}; //if we should display more info about the entry that the user can edit
		echo '<form action="admindocmgmtcatupd.php" method="post"><table><input type="hidden" name="id" value="'.$id.'">';
		$recordSet=&$conn->Execute('select name from docmgmtcategory where id='.sqlprep($id));
		if ($recordSet->EOF) die(texterror(STR_CATEGORY_NOT_FOUND));
                echo '<tr><td align="'.TABLE_LEFT_SIDE_ALIGN.'">'.STR_CATEGORY_NAME.':</td><td><input type="text" name="name" value="'.$recordSet->fields[0].'" size="30" maxlength="255" '.INC_TEXTBOX.'> ';
		echo '</table><input type="submit" value="'.STR_SAVE_CHANGES.'"></form> <a href="javascript:confirmdelete(\'admindocmgmtcatupd.php?delete=1&id='.$id.'\')">'.STR_DELETE_THIS_CATEGORY.'</a>';
	} else { //display categories, let the user pick one to edit
		echo '<form action="admindocmgmtcatupd.php" method="post" name="mainform"><table>';
		$recordSet=&$conn->Execute('select id,name from docmgmtcategory');
		if ($recordSet->EOF) die(texterror(STR_CATEGORY_NOT_FOUND));
                echo '<tr><td align="'.TABLE_LEFT_SIDE_ALIGN.'">'.STR_CATEGORY_NAME.':</td><td><select name="id"'.INC_TEXTBOX.'>';
		while (!$recordSet->EOF) {
			echo '<option value="'.$recordSet->fields[0].'">'.$recordSet->fields[1];
			$recordSet->MoveNext();
		};
		echo '</select></td></tr></table><input type="submit" value="'.STR_EDIT_SELECTION.'"></form>';
        echo '<a href="admindocmgmtcatadd.php">'.STR_ADD_NEW_CATEGORY.'</a>';
	};
?>
<? include('includes/footer.php'); ?>
Return current item: NOLA