;<html>
<head></head>
<h3>All comments: </h3>
<?php
//include information required to access database
require 'authentication.inc';
//start a session
session_start();
//still logged in?
if (!isset($_SESSION['db_is_logged_in'])
|| $_SESSION['db_is_logged_in'] != true) {
//not logged in, move to login page
header('Location: login.php');
exit;
} else {
//logged in
// Connect database server
$connection = sqlsrv_connect( $hostName, $connectionInfo )
or die("ERROR: selecting database server failed");
// Prepare query
$table = "comment";
$uid = $_SESSION['userid'];
$query = "SELECT UserId,Comment FROM $table where userid = '$uid'";
// Execute query
$query_result = sqlsrv_query($connection, $query)
or die( "ERROR: Query is wrong");
// Output query results: HTML table
echo "<table border=1>";
echo "<tr>";
// fetch attribute names
foreach( sqlsrv_field_metadata($query_result) as $fieldMetadata)
echo "<th>".$fieldMetadata['Name']."</th>";
echo "</tr>";
// fetch table records
while ($line = sqlsrv_fetch_array($query_result, SQLSRV_FETCH_ASSOC)) {
echo "<tr>\n";
foreach ($line as $cell) {
echo "<td> $cell </td>";
}
echo "</tr>\n";
}
echo "</table>";
// close the connection
sqlsrv_close($connection);
$comment=$_POST['comment'];
echo"<b>$comment</b><br>";
}
?>
<title>Comment Page</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<tr>
<form action method="post">
<td><h3> Input your new comment:</h3></td>
<td> <textarea rows="2" cols="50" name="comment"></textarea></td>
</tr>
<tr><br>
<input type="submit" value = "Submit"/>
</form>
<p><a href="main.php">Go back to main</a> </p>
</body>
</html>
this is what i have how do i save the comment and show it under the table