<?php
session_start();
include "../conn.php";
include "../functions.php";

$userID = checkAdmin(session_id());

if ($_POST["act"] == "add")
{
	$roomname = trim($_POST["roomname"]);
	$descr = trim($_POST["descr"]);
	if ($roomname == "")
	{
		$err = "Name cannot be empty";
	}
	else
	{
		mysql_query("insert into room (roomname, descr) values ('$roomname', '$descr')");
		header ("location: f.php");
	}
}

include "fheader.php";
echo "<form action=addf.php method=post><table width=80% align=center cellspacing=1 cellpadding=3>";
if ($err)
echo "<tr><td align=center><font color=red>$err</font></td></tr>";
echo "<tr><td><b>Room Name:</b><br><input type=text name=roomname value=\"$roomname\"></td></tr>";
//echo "<tr><td><b>Description:</b><br><textarea name=descr rows=5 cols=30 wrap=virtual>$descr</textarea></td></tr>";
echo "<input type=hidden name=act value=add><tr><td><input type=submit value=Add></td></tr>";
echo "</table>";

include "adminFooter.php";
?>