You would have to add a few columns to the database: email, name, date.
Then, use a basic HTML form that posts to a php script that grabs the variables, and inserts them into the database. You'd also need to pass the picure/row ID with the form.
Personally, I'd use the following table layout:
id - int(11), NOT NULL, auto_increment, Primary Key
photo - int(11), NOT NULL, ,
name - text, NOT NULL
email - text, NOT NULL
comments - text, NOT NULL
date - date/time
Then, the id would be a unique identified for each row, and the photo column would correspond to the current photo being viewed.
Here's some mock-up code that I can give you in less than 5 minutes (assuming you're using the database strucutre above):
<?php
if(empty($_POST['pic_id']))
{
?>
<html>
<head>
<title>Photo Comments</title>
</head>
<body>
<form action="comment.php" method="POST">
<input type="hidden" name="pic_id" value="<?= $_GET['img'] ?>">
<b>Your Name:</b> <input type="text" name="name"><br>
<b>Your Email:</b> <input type="text" name="email"><br>
<b>Comments:</b><br>
<textarea name="comments" cols="35" rows="15"></textarea>
<input type="hidden" name="date" value="<?= date("r") ?>">
<input type="submit" value="Add Comment">
</form>
</body>
</html>
<?
}
else
{
$name = $_REQUEST['name'];
$email = $_REQUEST['email'];
$date = $_REQUEST['date'];
$comments = $_REQUEST['comments'];
$pic_id = $_REQUEST['pic_id'];
$sql = "INSERT INTO `table_name` (photo, name, email, comments, date) VALUES ('$pic_id', '$name', '$email', '$comments', '$date')";
$result = mysql_query($sql);
if(!$result)
{
echo "mySQL Error: ".mysql_error();
}
else
{
echo "Comment added!";
echo "<a href='".$_SERVER['HTTP_HOST']."/photo.php?img=".$pic_id."'>Click here to return</a>";
}
}
?>
~Brett