First of all, you need a server and one that runs php.
It'd also be helpful if this server had a database which you could use, i.e. mysql.
The Logic:
You have a form, on a html or php page that has method set to POST (html/php doesnt really matter - it does if you're not planning on processing on a seperate page though..), you give the user some fields to fill in, ie. name, website, email, comment; you then give a submit button.
This submit button takes you to a page (for examples sake: process.php). On process.php you have a php script that takes the user input through the POST super global. You then process this and sanatise it (see mysql_injection ), after sanatising you save the data into a mysql table.
guestbook.php
You connect to mysql and select the relevant database.
Using a mysql function like mysql_fetch_arr ay() you print out the data using a while loop, in the format you'd like.
Comment