Home | Scripts | Tutorials | Books | Hosting | Forums | Links|

Navigation:

Home
Source code
Tutorials
RSS feeds
Articles
Wordpress plugins
Blog
Books
Software
Downloads
Hosting
manuals
Script directory
Training
Our Links






 
 

SPONSORS



 
 

Beginners guide to building a guestbook

In this example we will show you how to build your very own guestbook using PHP and MYSQL.

Overview

We will build a MySQL database to store our guestbook entries , a form for users to enter their details , a script that adds information into our database , a script to show all guestbook entries .
This is in no way meant to be a definitive guestbook app but it will help you in making your own.

Step 1 : Build the database

Start up MySQL and enter the following as shown in our actual screenshot.

This is our database with one table called guestbook which contains four fields id , name , message and email.

Step 2 : Create the form

a fairly simple step this one , just create a form with text fields for the name and email address and a textarea for the comments . Add a submit button and a reset button . Here is the complete code and example that we used.

code and example form

Step3 : storing user submitted info

In this step we create a script which will store the information that a user submitted their name , email address and coments .

code for adding to our database

Step 4 : viewing user entries

Theres no point in having a guestbook if you and your users cannot view the entries . With this script we simply show the entries in a basic table , of course you can make your table look far more sophisticated if you wished

code for viewing entries

and that is your very basic guestbook system , in future tutorial / examples we will look at validation of data , deleting entries and more