Where does $id come from?
If you want to test if a variable is set use
empty() or
isset():
or
instead of
Is the idea to stop the function being used if you're logged in?
Also you probably want the mysql_query() call inside the else statment:
Code: Select all
} else {
$ip = $REMOTE_ADDR;
$now = date("F j, Y, g:i a");
$sql = "INSERT INTO guestbook (name,email,location,check,homepage,comment,ip,date_time,authorised) VALUES ('$name','$email','$location','$check','$homepage','$comment','$ip','$now','No')";
// run SQL against the DB
$result = mysql_query($sql);
}
instead of
Code: Select all
} else {
$ip = $REMOTE_ADDR;
$now = date("F j, Y, g:i a");
$sql = "INSERT INTO guestbook (name,email,location,check,homepage,comment,ip,date_time,authorised) VALUES ('$name','$email','$location','$check','$homepage','$comment','$ip','$now','No')";
}
// run SQL against the DB
$result = mysql_query($sql);
Mac