I have been following your blog tutorial video's, and everything works fine but the blog_read page. It simply shows By on (0 comments), and the comments form.
I searched your forum, and read another topic with the same problem, but unfotunatly the topic didn't solve mine.
I added error_reporting(E_ALL); to the page and it now reads "Notice: Undefined index" for everything(title, user, date, etc...). As well as " Warning: Invalid argument supplied for foreach() " on line 45.
Im not sure how I fix this.
blog_read.
<?php error_reporting(E_ALL); include('core/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"> <head> <meta http-equiv="content-type" content="text/html; charset=UTF-8"> <title>BetterPHP - Blog Tutorial</title> </head> <body> <div> <?php if (isset($_GET['pid']) === false || valid_pid($_GET['pid']) === false){ echo 'Invalid Post ID.'; }else{ $post = get_posts($_GET['pid']); ?> <h2><?php echo $_GET['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){ ?> <hr>By <?php echo $comment['user']; ?> on <?php echo $comment['date']; ?></hr> <p><?php echo $comment['body']; ?></p> <hr /> <?php } ?> <form action="" method="post"> <p> <label for="user">Name</label> <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 } ?> </div> </body> </html>Any help would be appreciated.