Location: PHPKode > projects > PHPdir > phpdir/admin/dept.php
<?
include	('dbkey.php');
include	('queries.php');
include	('functions.php');
include	('head.admin.php');

if ($action == 'add') {

	add_dept($action,$department);

} elseif ($action == 'edit') {

	edit_dept($action,$serial);

} elseif ($action == 'del') {

	del_dept($action,$serial);

} elseif ($action == 'upd') {

	upd_dept($action,$serial,$deptartment);

} else {

	echo "<td valign=\"top\"><p>Enter a new department:</p>
		<form action=\"$adm_path/dept.php?action=add\" method=\"post\">
		<input type=\"text\" name=\"department\" size=\"15\">
		<input type=\"image\" src=\"$img_path/button_add.gif\" border=\"0\" alt=\"Add department!\"></form>
		<p>Or edit an existing department:<br>
		<span class=TinyText>When deleting departments, make sure no contacts exist in that department.</p>
		<form action=\"$adm_path/dept.php?action=edit\" method=\"post\"><select name=\"serial\">";

	/* List departments in DB and build SELECT */

	$link_list = mysql_connect($dbhost,$dbuser,$dbpass)
		or die("Could not connect to the database");
	mysql_select_db($dbname,$link_list)
		or die("Could not select the database");
	$result_list = mysql_query($select_dept_list);

	while ( $a_row = mysql_fetch_array( $result_list ))
		{
		 print "<option value=\"$a_row[serial]\">$a_row[department]</option>\n";
		}

	echo "</select>
		<input type=\"image\" src=\"$img_path/button_edit.gif\" border=\"0\" alt=\"Edit department!\">
		</from></td>";

}

include	('footer.php');
?>
Return current item: PHPdir