Hmm I just realised I totally forgot about your request for a book

Now depending on what you are interested in, I can think of several ways to do a guestbook and chatroom script. You can either download a free one like
this and install it. Or you can write one from scratch. But then you have to learn at least one programming language and maybe also SQL (database stuff where you store the comments for the guestbook).
Ok, so let's assume you want to do it yourself

You will probably choose
php or CGI / Perl. If your server is windows based, then ASP is an option. Now, assuming you want PHP, which is the most popular web programming language, I would suggest one of the following books:
Sams Teach Yourself PHP in 24 Hours, Third Edition (Paperback) or
Sams Teach Yourself PHP, MySQL and Apache All in One (3rd Edition) (Sams Teach Yourself) (Paperback) which covers php, and the database and some stuff about the very popular apache webserver. Now, one of these books actually has a guestbook example in it.. But don't hold me on that, as mine are old first editions... Hope this helps some