session_start();
if (!session_is_registered("LLC"))
{
// if session check fails, invoke error handler
header("Location: ../loginform.php");
exit();
}
$user = $_SESSION['UNAME'];
$dpt = trim($_POST['dpt']);
if ($dpt == '')
{
print "
You must enter the department.
";
exit();
}
include("../include/dbconfig.php");
$connection = mysql_connect($db_host, $db_user, $db_pass) or die ("Unable to connect!");
mysql_select_db($db_name);
$query = "insert into SR_department set Department='$dpt'";
$result = mysql_query($query, $connection) or die ("Error in query: $query. " . mysql_error());
header("Location: manage.php");
exit();
?>