University of Delaware

Guestbook Help Page

The guestbook script can be used to collect information from a form on a Web page; the collected information is placed in a data file in your Web directory.

  1. Create the file in which you will collect the information. From your Web directory, at the % prompt, type

    touch guestbook.db
  2. Set the permissions on your guestbook.db. Type

    chmod 606 guestbook.db

  3. Create the Web page on which the form will appear. In the "form" tag, set "method" to "post" and "action" to the path for the guestbook script followed by the path to the file you created in the first step.

An example HTML file:

<title> Guest Book Test Page </title>
<h1> Guest Book Test </h1>
<form method=post action=>
Name: <input name="Person" size=50> <br>
E-mail: <input name="E-mail" size=50> <br>
<input type=submit> <input type=reset>


There are two fields in the example, "Person" and "E-mail." Every time this form is submitted, these fields will be appended to your data file. The file must be writable by others (chmod 606 test-guestbook.db).

Click here to try out the example form.

The guestbook data file:

Here's an example of what the data file would look like:
Person=John Doe
Person=Rod Runion
Person=Jane Doe

Each time the form is submitted, several lines are appended to test-guestbook.db. For each field, a line of the form "name=value<newline>" will appear, followed by a line with two pound signs "##<newline>". Any "newline" characters entered on a form will be converted to "\n" and any backslash characters will be converted to "\\" in the data file.

Click here to see the data file for the example form.

To view the data file from within your Web directory, use any text editor. For example, type

pico guestbook.db

IT Help Center
Questions or Comments
University of Delaware Home Page
Last updated: April 18, 2005
Copyright © 2003-2005 University of Delaware