I am getting an error "Parse error: syntax error, unexpected ';' in blog_read.php on line 7"
when the code looks correct to me..Here is the code:
blog_read.php
[syntax=php]<?php
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();
}
?>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Blog</title>
</head>
<body>
<div>
<?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){
?>
<p><?php echo $comment['body']; ?></p>
<h4>By <?php echo $comment['user']; ?> on <?php echo $comment['date']; ?></h4>
<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" col="60"></textarea>
</p>
<p>
<input type="submit" value="Add Comment!" />
</p>
</form>
<?php
}
?>
</div>
</body>
</html>[/syntax]
Thanks for anyone who can probably help this small issue
![Smile :)](./images/smilies/icon_e_smile.gif)