Here is my form and displaying comment:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1" />
<title>Leave a comment.</title>
</head>
<body>
<font color="#000000"><form method="post" action="thankyou.php">
<label for="name"><b>First Name:</b></label><br />
<input type="text" id="name" name="name" /><br />
<br />
<label for ="comment"><b>Comment:</b></label><br />
<input name="comment" type="text" id="comment" /><br />
<br />
<label for="email"><b>Email: </b></label><br />
<input name="email" type="text" id="email" /><br />
<input type="submit" value="Enter Comment" name="submit" />
</form></font><br /><br />
<font color="#000000"><?php
$dbc = mysqli_connect('host', 'Hereisfun', 'password', 'Hereisfun')
or die('Error connectiong to MYSQL server.');
$sql = mysqli_query($dbc, "SELECT * FROM cmmnts2");
while ($row = mysqli_fetch_array($sql, MYSQLI_ASSOC)) {
echo 'Name: '.$row['name'].'<br />Comment: '.$row['comment'].'<br />Date: '.date('M/d/Y h:i A', $row['date']);
}
?></font>
</body>
</html>
And here is my inserting into db code:
<html>
<head>
<title> Thank you for entering your comment. </title>
</head>
<body link="#000000" bgcolor="#CCCCCC">
<font color="#000000"><div align="center"><?php
$name = $_POST['name'];
$comment = $_POST['comment'];
$email = $_POST['email'];
$dbc = mysqli_connect('host', 'Hereisfun', 'password', 'Hereisfun')
or die('Error connectiong to MYSQL server.');
$query = "INSERT INTO cmmnts2 (name, date, email, comment) " .
"VALUES ('$name', ' .time(). ', '$email', '$comment')";
$result = mysqli_query($dbc, $query) or die('Error querying database.');
mysqli_close($dbc);
echo 'Thanks for submitting your comment!<br />';
echo 'Name: ' . $firstname . '<br />';
echo 'Comment: ' . $comment . '<br />';
echo 'Email: ' . $email . '<br />';
?>
<p><a href="comment.php"> Post another comment.</a></p>
</div>
</font>
</body>
---------
Its pretty much a blank page at the moment, the comments work fine i just need to add some line breaks...the time thing is always 1969 ^-^;