problems with blog
Posted: Sat Oct 08, 2011 1:08 am
hi.. im using your blog script and im having problem with the commenting system .. the comments are not showing under the blog entry even though it is being sent to the database can you help me ? .. here are some of my codes ..
<?php include('init.inc.php'); if(isset($_GET['pid'], $_POST['user'] , $_POST['body'])){ if(add_comment($_GET['pid'] , $_POST['user'] , $_POST['body'])){ header("Location: blog_read.php?pid={$_GET['pid']}"); }else{ header("Location: blog_list.php"); } die(); } ?> <!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" dir="ltr" lang="en-US" xml:lang="en"> <head> <body> <?php if(isset($_GET['pid']) == false || valid_pid($_GET['pid']) == false) { echo "Invalid post ID."; }else{ $post = get_post($_GET['pid']); ?> <h2><?php echo $post['title']; ?></h2> <h4>By <?php echo $post['user']; ?> on <?php echo $post['date']; ?> (<?php echo count($post['comments']); ?> comments)</h4> <hr> <p><?php echo $post['body']; ?></p> <hr> <?php foreach($post['comments'] as $comment){ ?> <h4>By <?php echo $comment['user']; ?> on <?php echo $comment['date']; ?></h4> <p><?php echo $comment['body']; ?></p> <?php } ?> <h3>Comment : </h3> <form action="" method="post"> <p> Title : <input type="text" name="user" id="user"> </p> <p> <textarea name="body" rows="20" cols="60"></textarea> </p> <p> <input type="submit" value="Add Comment"> </p> </form> <?php } ?>