…use these to jump around or read it all
[The Process]
[The Files]
[Guestbook]
[The Thank-You Page]
[Altering the Guestbook]
Welcome to Active Server Pages (ASP) Example #3, A
guestbook with “Thank You” page. 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.
As was stated in ASP Example #2, this
tutorial will not get into what ASP is all about or how to find out if you have ASP
capabilities. That’s all covered in ASP Example #1. So, if you haven’t
already, head over to the ASP Example #1 and read all about it. You’ll get the ASP scoop and
a small program to test your server for ASP capabilities.
And again – ASP is not supported by all servers. In fact, you
can’t see the Guestbook presented here in action. Why? The HTML Goodies servers do not
support ASP. *sigh*
The Process
The young gentleman who wrote these ASP pages for me actually
thought I was pulling his leg when I told him how popular the concept of getting a thank-you
page following a guestbook submit had become. He wanted to know why people wanted such a thing.
I said, “Shut up and get writing. I’m paying you by the hour.”
Actually I paid him a flat rate. It’s a good thing too. He
didn’t quite know how he was going to get the effect. He actually had to go back to his
apartment and call a bunch of his ASP buddies to talk over how the effect would be
achieved. What you get in this tutorial is what they all arrived at. No, I didn’t pay the
consulting ASP artists. Seeing what the first guy charges me, they’re all probably
wealthy anyway.
Here’s the deal:
- The form that acts as the Guestbook is created through simple HTML commands, making sure
that every form element is given a NAME attribute. - The main FORM tag has its ACTION attribute pointing at the thank-you page rather than
at a mailto: command. - All of the VBScript that sends the mail along is contained on the thank-you page. Thus,
the change of page was going to happen whether a guestbook was involved or not. The thank
you text displays and the mail are both sent all from the second page. It’s a very clever system.
Maybe those other guys should have gotten paid.
The Files
You’re going to have to have two. As was the case in ASP
Example #2, I am offering the files as HTML documents. When you click on the links below,
you’ll see code. Copy the ENTIRE code and paste it to a text editor.
The first thing you copy should be the code: <%@ LANGUAGE=”VBSCRIPT” %>.
That starts off all ASP pages.
Then, when you save
the code, name it what ever you want and make sure it has an “.asp” extension.
The “.asp” extension is very important and not adding it is
the main cause of these tutorials not giving people the effect they’re looking for. Here
are the files:
- asp_gb.html This is the Guestbook page code.
- asp_ty.html This is the thank-you page code
Again, just to drive a point home, copy and paste the code and
save it with an “.asp” extension.
The Guestbook Page
The Guestbook page should be pretty familiar to you coding to
you by now. If not, go read the Forms tutorial right
away. You’re in over your head here.
Right now the form is just two text boxes named
yourname and email, a couple of radio buttons named answer, and
a submit button.
Yes, you will be able to add and alter the items that make up the Guestbook page, but right
now let’s stay on track.
Notice This!
Did you see that there was some bold text when you copied and pasted?
The bold text was the ASP page the ACTION attribute pointed to. It looked like this: