What you have above is a very simple guestbook setup
using two text boxes, five radio buttons, and a text area. Remember these input
items are covered in the forms lesson.
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 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:
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:
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:
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:
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:
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.
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.
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.