i keep getting this error in my code, trying to build a guestbook
this is the error
Parse error: parse error, unexpected ';' in C:\Program Files\Apache Group\Apache2\htdocs\shopbots\guestbook2.php on line 41
code is
<?php
if(isset($_POST['comments']{
$comments = $_POST["comments"]; - this line it points to
//check comment has been entered
if (strlen($comments) > 0) {
$comments = stripslashes($comments);
} else { // if there are no comments..
$comments = NULL;
echo '<p><font color="red" size"+1">You forgot to enter your comments!</b</p>';
}
//if everything was filled out ok
if ($username && $email && $comments) { // if everything's ok
//Add comments
$query = "INSERT INTO guestbook (username, email, comments) VALUES ('$username','$email','$comments')";
$result = @mysql_query ($query); // run the query.
if ($result) { // If it ran ok.
echo '<h3>Thank you for leaving a comments!</h3>';
//are you sure you want the footer here??
include ('includes/footer.html'); // include the HTML footer.
exit();
} else { // If it did not run ok.
echo '<p><font color="red" size="+1">You could not leave a comment due to a system error. We apologise for any inconvenience.</font></p>';
}
mysql_close(); // Close the database connection.
}
}
}
?>