this tutorial was written in and older version of php...the Register_global function has been turned off(this variable allowed the user to have a form element name and access the data with the php variable $name....)
for safety reasons this is now been changed to $POST['name']; for form with the method POST and $GET['name'] for forms with the method GET...
make this change in your code in the part that says
q=$"INSERT into guestbook (id,name,email,sitename,siteurl,date,ip,comments)
VALUES ('','".$POST['name']."'','".$POST['email']."','".$POST['sitename']."','".$POST['siteurl']."',now(),'$REMOTE_ADDR','".$_POST['comments']."')";
hth