![]()
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.
chmod 606 guestbook.db
<html> <head> <title> Guest Book Test Page </title> </head> <body> <h1> Guest Book Test </h1> <form method=post action=http://www.udel.edu/cgi-bin/guestbook/topics/internet/WWW/test-guestbook.db> Name: <input name="Person" size=50> <br> E-mail: <input name="E-mail" size=50> <br> <input type=submit> <input type=reset> </form> </body> </html>
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.
Here's an example of what the data file would look like:
Email=johndoe@udel.edu Person=John Doe ## Email=roadrunner@udel.edu Person=Rod Runion ## Email=janedoe@udel.edu 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