Location: PHPKode > projects > Simple Comments > comments/insertcomment.php
<? require("header.php"); ?>
<p align="center">
<?
require_once( 'config.php' );


$name=$_POST['name'];
$email=$_POST['email'];
$message=$_POST['message'];
$timedate=date("D, d M Y h:i A");
$ip=$_SERVER['REMOTE_ADDR'];

if ($name!=="" && $message!=="")
{
mysql_connect($dbaddress,$dbuser,$dbpass);
@mysql_select_db($dbname) or die( "Unable to select database");
$query = "INSERT INTO comments VALUES ('0','$name','$email','$timedate','$message','$ip')";
mysql_query($query);
mysql_close();
echo "Comment Added.";
echo "<br><br>You will have to refresh the comments page inorder to see your comment.";
?>
<br><br>
<a href="javascript: history.go(-2)">Back</a><br>
<?
} else {
echo "You must enter your name and a message.";
?>

<br><br>
<a href="javascript: history.go(-1)">Back</a><br>
<?
}
Return current item: Simple Comments