<div id="comments_wrap">
<a name="comments">
<?php
[COLOR="Blue"]//this used to be comment_display.php[/COLOR]
mysql_connect ('localhost', 'root', 'root');
mysql_select_db ('Blog');
$entry = basename(__FILE__);
$post_id = mysql_query("SELECT entry_id FROM blog_entries WHERE title = '$entry' LIMIT 1");
[COLOR="Red"][B]//when I echo post_id at this point, it doesn't display. That must mean that it is a NULL value.
//that means that something's wrong with our query...I think[/B][/COLOR]
$row = mysql_fetch_assoc($post_id);
$post = $row['entry_id'];
$query = mysql_query("SELECT * FROM `blog_comments` WHERE post_id='$post'");
while($row = mysql_fetch_assoc($query)) {
$date = $row["month"].'.'.$row["day"].'.'.$row["year"];
$time = $row["hour"].':'.$row["minutes"];
echo
' <div id="comment_'.$row["id"].'" class="comment">
<div class="details">'.$row["name"].'<br>'.$date.'<br>'.$time.'</div>
<div class="v_line"></div>
<div class="message">'.$row["comment"].'</div>
</div>';
}
?>
[COLOR="blue"] //below this, in the hidden field in which we get entry's value,
//is it possible that $post is not recognized because we have already closed php?
//Does it know that it was used in the above script and remember its value?
//If not, then everything would make sense. Does that make sense?[/COLOR]
<form method="post" action="comment_process.php">
<input type="hidden" name="entry" value="<?php echo [COLOR="Red"]$post[/COLOR]; ?>" />
<label for="name">Name</label>
<input type="text" name="name" value="" />
<label for="website">Website</label>
<input type="text" name="website" value="" />
<label id="comment_label" for="comment">Comment</label>
<div id="instructions">
</div>
<textarea rows="5" cols="10" name="comment"></textarea>
<input id="submit" type="submit" name="submit" value="Submit" id="submit" />
</form>
</div>