PHP Guestbook Script

Written By: Nick Tiberi

- 08 May 2006 -
















Description: In this tutorial we will create a simple but functional guestbook using PHP. All you need is a text editor and a web host that supports PHP. No MySQL is needed.

  1. Create the Form
  2. Handle the Data
  3. View Data Only

View Data Only

What if someone doesn't want to sign the guestbook, and instead only wants to view entries? Simple. Just create a link in the "index.php" file to something like "viewguestbook.php." The viewguestbook.php file is similar to the guestbook.php file except we don't have to handle any data — just display it. Here's the whopping 3 lines of PHP code required to display the data on the viewguestbook.php page:


        readfile("data.txt");
?>

Conclusion

That's pretty much it! You've just built a simple guestbook using PHP. There's a ton of stuff that could be added to it, but this is just a quick and easy demonstration of what can be done with PHP in a short amount of time.

<< Previous