Location: PHPKode > projects > Blackbeard's Revenge > inn.php
<?php
require_once "headers.php";
require_once "common.php";


echo"<BODY><div align=left>";
print "<form action=\"inn.php\" method=\"POST\">";
echo "<br><br>";
echo "<table class=\"menu\">";
echo "	<tr>";
echo "		<td class=\"menuheader\" style=\"height:25px;width:450px;text-align:center\">The Tavern</td>";
echo "	</tr>";
print "	<tr><td colspan=2><div align=center><table class=\"data\" border=0 style=\"width:290px\">";
print "	<tr><td class=\"header\">Add something</td></tr>";

	if($_POST["say"])
	{
		$query = "INSERT INTO commentary (uid, text) VALUES (". $_SESSION['uid'] .",'". $_POST["newtext"] ."')";
		echo $query;
		$result = db_query($query);

		echo "<META HTTP-EQUIV=\"refresh\" content=\"1;URL=inn.php\" target=_top\">";
	}
	else
	{
		$query = "SELECT * FROM commentary, players WHERE commentary.uid = players.uid";
		$result = db_query($query);

		/* Printing results in HTML */		
		print "<tr><td><table class=\"data\" border=0 style=\"width:446px\">";
		print "	<tr><td class=\"header2\">You overhear...</td></tr>";

		while ($row = db_fetch_assoc($result)) {		
			echo "<tr>";
			echo "<td class=\"chatline\">". $row["name"] ." says ". $row["text"] ."</td>";		
			echo "</tr>";		
		}	
		/* Free resultset */
		db_free_result($result);
		
		print "<tr><td style=\"text-align:center\"><div align=center><table class=\"data\" border=0>";
		print "<tr><td class=\"body\"><input type=\"text\" name=\"newtext\" class=\"chat\"></td></tr>";	
		print "<tr><td class=\"body\" style=\"text-align:center\"><input class=\"button\" type=\"Submit\" name=\"say\" value=\"Say it\"></form></td></tr></table>";
		print "</div></td></tr>";
		
	}
	print "</table></td></tr>";
	print "</table>";
	
?>
Return current item: Blackbeard's Revenge