<?php 
include ('css_head.php');
?>

<?php
	

	$db_comments = "comments";
	$table_comments = "CommentCards";
	$today = "";
	$today = date("Y-m-d");
	$connection = @mysql_connect("libitdb.lang.uc.edu", "phpadmin", "25or624")
		or die("Couldn't connect.");


	//Select a database
	$db = @mysql_select_db($db_comments, $connection)
	       or die("Couldn't select database. $db_comments");


	//SQL statement
	$query= "SELECT DISTINCT Location FROM $table_comments ORDER BY Location" ;


	//execute SQL query and get result
	$sql_result = @mysql_query($query, $connection)
	               or die ("Couldn't execute query <p>$query</p>");

	if (!$sql_result) {
		echo "<p>couldn't get list! $sql_result</p>";
	}
	else
	{
		echo "
<h2 align=\"center\">Add a Comment</h2>
<form method=\"post\" action=\"update_card.php\">
<table width=\"100%\" border=\"1\" cellpadding=\"10\">
     <tr>
         <td>What Features or Services would you like to see in University Libraries?</br><textarea name=\"featuresText\" cols=\"30\" rows=\"10\"></textarea></td>         	 <td>How Can we improve our services to better meet your needs?</br><textarea name=\"improvementsText\" cols=\"30\" rows=\"10\"></textarea></td>
         <td>General coments about your visit to University Libraries</br><textarea name=\"commentsText\" cols=\"30\" rows=\"10\"></textarea></td>
     </tr>
     <tr>	 
	 <td colspan=\"2\"><p><STRONG>Location:</STRONG>
          <select name=\"lock_location\">
            <option selected value=\"\">Select.......</option>
			";
				while ($row = @mysql_fetch_array($sql_result)) {
					$location = $row['Location'];

					echo "<option>$location</option>";
				}
		echo "
	  <td valign=top>
	   <p><input type=\"radio\" checked name=\"PType\" value=\"Faculty\">Faculty 
	   <input type=\"radio\" name=\"PType\" value=\"Staff\">Staff
	   <input type=\"radio\" name=\"PType\" value=\"Student\">Student</p>
	</td>
          </select><p></td>
     	<td align=\"center\"><input type=\"submit\" name=\"Submit\" value=\"submit\"></td>
     </tr>
</table>
</form>
";
}
?>
<?php 
include ('css_foot.php');
?>
