So, You Want A Guestbook, Huh?

By Joe Burns

Use these to jump around or read it all...
[A Basic Guestbook] [The Program That Made It]
[Simple Mailto: Guestbooks] [Mailto: Downfalls]
[Augmenting Your Guestbook Output]
[Guestbooks With CGIs]
[Attaching Email Output To A CGI]
[Guestbooks With Virtual Pages]
[Guestbook CGIs] [One More Option (ASP)]


     I get a great many e-mail letters asking for me to put up a tutorial on making a guestbook. Usually I just tell the writer to see my tutorial: So, You Want A Form, Huh? Then a few people began to write back saying that what I was offering in the forms tutorial wasn't quite what they were looking for. Here I'll attempt to expand on the tutorial to show how the items are used to make a guestbook.

     I will go over three different types of guestbooks:

  • Simple "mailto:" guestbooks
  • Guestbooks that offer a page thanking the person for writing
  • Guestbooks that post what your visitors write to a separate page


A Basic Guestbook

     We'll start at the beginning. Between the double lines below is a simple guestbook.



Sign In, Please...

Please enter your name:
and your e-mail address:  

What do you think of my guestbook?

It's Great! It Stinks! You Stink!
I Stink! We All Stink!

Make any comments you'd like below:

Thanks for your input

Please do not click the buttons as they are not attached to any address and will give you an error. This is for demonstration purposes only.



Below is the program that posts it:
Just cut and paste it, if you'd like...



<H3> Sign In, Please...</H3>
<FORM METHOD="POST" ACTION="mailto:user@writemehere.com">

<B>Please enter your name:
</B><INPUT NAME="username" size="30"> <BR>

<B>and your e-mail address:
</B><INPUT Name="usermail" size="30">
<p>


<B>What do you think of my guestbook?</B>
<P>

<INPUT TYPE="radio" NAME=I_think_that VALUE="It's_Great">
It's Great!
<INPUT TYPE="radio" NAME=I_think_that VALUE="It_stinks">
It Stinks!
<INPUT TYPE="radio" NAME=I_think_that VALUE="You_stink">
You Stink!
<BR>
<INPUT TYPE="radio" NAME=I_think_that VALUE="I_stink">
I Stink!
<INPUT TYPE="radio" NAME=I_think_that VALUE="We_all_stink">
We All Stink!
<P>


<H3>Make any comments you'd like below:</H3>
<CENTER>
<TEXTAREA NAME="comment" ROWS=6 COLS=60></TEXTAREA>
<P>
<B>Thanks for your input</B>
<BR>

<INPUT TYPE=submit VALUE="Send it!">
<INPUT TYPE=reset VALUE="Start over">
</CENTER>
</FORM>



Simple Mailto: Guestbooks

     What you have above is a very simple guestbook setup using two text boxes, five radio buttons, and a text area. If what I just wrote is Greek to you, you really should read So, You Want A Form, Huh? first. I won't be explaining the above guestbook outside of implementing it to send mail. The input items are covered in the forms tutorial.

     If all you want is a simple guestbook that sends mail to you -- boom. You're done. Just...

  • Cut and paste the guestbook above to a page
  • Place your e-mail address where it says user@writemehere.com
  • Put it up for the world to use

A Couple Of Mailto: Downfalls

  • It only works with Netscape-style browsers and Explorer 4.0.
    Earlier Explorer browsers do not recognize this is a form working with a "mailto:" command. It simply puts up the e-mail box as if it was a regular "mailto:" HREF command.
  • There is no confirmation of sent mail.
  • The text arrives as one long line, like so:
    Hello+I'm/+very=glad/=to=meet+you. +/I+like+/your+%guestbook.$
    You can read it, but it's tough. -- or --
  • The mail arrives as an attachment labeled a .dat file.
    The .dat file suffix stands for "data". It has to be opened in a text editor or through changing the suffix to ".txt." You may be able to alter this in your e-mail program. There is often a configuration you can alter that will put attachments right into the e-mail body. Look through your configuration settings for that.


Augmenting Your Guestbook Output

     The following are two additions to the basic guestbook. These allow you to -maybe- change the output of your guestbook.

  • Send Output As Text

     If you've set up your guestbook and the result arrives in your e-mail box as a long line of strange text or as an attachment, this is for you!
     Follow the same FORM command format as above, except add another subcommand: ENCTYPE="text/plain". Like so:

<FORM METHOD="POST" ACTION="mailto:login@yourserver.net" ENCTYPE="text/plain">

     The "ENCTYPE" command stands for Encryption Type. It's telling the server to return the mail as text only. If it works you'll get an output something like this:

Name=Joe Burns
Email=jburns@htmlgoodies.com
Comment=This thing works!

  • Send A Specific Subject Line

     Thank you to Sherman Dorn for this hot tip.... If you'd like to set aside your guestbook output from other e-mail you receive, you can do it simply by adding a subject to your e-mail address inside the FORM format command. Like so:

<FORM METHOD="POST" ACTION= "mailto:login@yourserver.net?subject=whatever subject you want" ENCTYPE="text/plain">

     Notice that all I did was add a "?" right after the e-mail address and then "subject=." Please note you do not surround the subject in quotation marks. There is only one at the beginning of the mailto: command and one at the end of the subject line. That's it.

  • Send A CC to Someone

     The format is to add "&cc=" and then the e-mail address of the person who should get the carbon copy. Thusly...

<FORM METHOD="POST" ACTION= "mailto:login@yourserver.net?subject=whatever subject you want&cc=joe@earthweb.com" ENCTYPE="text/plain">

  • Send Multiple Copies

     This isn't always successful depending on browser version, but give it a shot. You should be able to list as many e-mail addresses as you like, separated by commas and no spaces, and all should get the guestbook output. Like so:

<FORM METHOD="POST" ACTION= "mailto:login@yourserver.net,joe@earthweb.com,bob@earthweb.com">

  • Get that TEXTAREA to Wrap

     If you've made a bunch of forms, then you know that TEXTAREA boxes usually don't wrap the text. It just keeps rolling off the page. Well, fear not. Add this: WRAP="virtual" to your TEXTAREA boxes and the text will wrap right around. It looks like this:

<FORM>
<TEXTAREA COLS="50" ROWS="75" WRAP="virtual">
</FORM>

  • Use an Image to Submit!

     Instead of the dull, gray image button, allow your viewers to click on an image to submit your form. Go here for how it's done.


Guestbooks With CGIs

     Now the fun part. If you attach the output of your guestbook to a CGI, you can do a great many things. For one, you can make it so the mail arrives in your box looking like regular e-mail without all the gibberish. (If you get the tip above to work, you probably won't need this.) You can also make it so a page comes up that thanks the person for sending e-mail. And you can also make a "graffiti wall" where people can post e-mail messages. I'll show you how to do each right here.


Attaching The E-mail Output To A CGI

     This is done inside the FORM command. Here's the FORM line from the guestbook above:

<FORM METHOD="POST" ACTION="mailto:user@emailaddress.com">

     See the ACTION? It's telling the server what to do with the output (what the viewer writes) of the form. In this case it is telling the server to send it through the mail system.
     The reason all the gibberish shows up is because that's actually what your mail looks like to the computer. When you're using a nice mail program, all the stuff is made to look like space, but when you send mail this way, all the stuff is made visible.
     Now look at this:

<FORM METHOD="POST" ACTION="cgi/email">

     See how the ACTION is sending the information to something on my site named "email?" Notice it's in a directory named "cgi?" That's what I'm talking about when I say to attach your guestbook to a CGI. You send the output of the page to a CGI that manipulates it and offers output (if you wish).

Please note: You cannot attach to my CGIs through the above path. It does not exist. I made it up for demonstration purposes.


     For instructions on how to attach your guestbook to a CGI, see my tutorial So, You Want To Place A CGI, Huh? It is a new tutorial that gives you the HTML document, the CGI, and instructions on how to place it on your server.


Guestbook That Posts Messages

     This is a guestbook that posts what the person writes to another page. Thus everyone can read what others write. It works a lot like a BBS server. Watch it though, this takes up a lot of space after a while.

Go here to do it yourself.


Guestbook CGIs

     First off, you need to find out if you can place one of these on your server.
     You see... CGIs are more than just little text files. They are small programs that do tricks, like manipulate e-mail data. The problem comes in that CGIs must be sitting in an "activated" directory. This is a place that the server knows where a little program sits, rather than just text.
     You need to ask your Webmaster, service tech, or the person who takes your checks each month if you are able to place your own CGIs. The easiest way is to get the person to make you a sub-directory of their primary CGI directory. All sub-directories carry the same properties as the higher-level directory. Or just find out if you have the ability to activate your own directories

One More Option (ASP)

     Everybody loves putting together a great guestbook, and through the use of ASP, you can get that all-important secondary page that pops up right after the user submits. But more than that, you get to configure the thank-you page to include the user's name and other responses depending on what the user entered into the guestbook form. Want to try it? Go here!


     That's about the extent of what I can show you right now. Please check back soon though as I will be adding to this page.

 

[A Basic Guestbook] [The Program That Made It]
[Simple Mailto: Guestbooks] [Mailto: Downfalls]
[Augmenting Your Guestbook Output]
[Guestbooks With CGIs]
[Attaching Email Output To A CGI]
[Guestbooks With Virtual Pages]
[Guestbook CGIs] [One More Option (ASP)]

Make a Comment

Loading Comments...

  • Web Development Newsletter Signup

    Invalid email
    You have successfuly registered to our newsletter.
  •