Creating the Confirmation Page

The confirmation page is displayed by IDC after the purchase data has been saved. In the confirmation page, you will thank the user for his or her purchase and then display commercial information on the subject matter of the purchase. For example, if the user has purchased Inside Microsoft Visual Basic, Scripting Edition, he or she will be directed to the New Technology Solutions, Inc., web site for more information.

Step 1

Start a new document in your text editor. This document will be the confirmation page. The document will be saved as purchase.htx in the \scripts\project3 folder with the rest of your htx files. Create the head section of the page by adding the following code:

<HTML>
<HEAD>
<TITLE>Thank You</TITLE>
</HEAD> 

Step 2

The body section begins with an image that displays a message thanking the user. Add the image to the body section with the following code:

<BODY BGCOLOR="WHITE">
<CENTER>

<IMG SRC="/project3/thanks.gif" ALT="Thank you for your purchase"
WIDTH=450 HEIGHT=100><P>
<BR> 

Step 3

If the user has purchased a book with the keyword database in the title, you will direct him or her to other books about database programming. Note how the page accesses the purchased book's title by referencing the form input variable. You can reference form input variables in an htx file by prefixing them with idc. Add the following code to display the titles of additional database books:

    <%If idc.txtTitle CONTAINS "database"%>
        <FONT FACE="ARIAL" SIZE=3>
        Check out these other hot titles on
        database development!<P>
        <A HREF="/scripts/project3/title.idc?txtTitle=
Applying+SQL+in+Business">
        Applying SQL in Business
        </A><P>
        <A HREF="/scripts/project3/title.idc?txtTitle=
Paradox+made+easy">
        Paradox made easy
        </A><P>
        <A HREF="/scripts/project3/title.idc?txtTitle=
Oracle7;+the+complete+reference">
        Oracle7; the complete reference
        </A><P>
        </FONT>
    <%EndIf%> 

Step 4

If the title of the purchased book contains the keyword visual, the page directs the user to the Microsoft web site, in which he or she can learn more about visual tools. A link is built directly into the page with the anchor tag only if the title of the book contains the word visual. Add the following code to display the Microsoft link:

    <%If idc.txtTitle CONTAINS "visual"%>
        <FONT FACE="ARIAL" SIZE=3>
        For more information on visual tools, <BR>
        check out the <A HREF="http://www.microsoft.com">
        Microsoft</A> web site!
        </FONT><P>
    <%EndIf%> 

Step 5

If the title of the purchased book contains the keyword programming, the user is treated to a Microsoft PowerPoint animation. This PowerPoint show is displayed with the PowerPoint Animation Player, which is an ActiveX control. The control is available on the companion CD and will display any PowerPoint slide show in a web page. Consult Project #1, in Chapter 6, for more information about the PowerPoint Animation Player and how to install it. Add the code at the top of page 338 to display the slide show.

    <%If idc.txtTitle CONTAINS "programming"%>

        <OBJECT
        CLASSID="clsid:EFBD14F0-6BFB-11CF-9177-00805F8813FF"
        WIDTH=320
        HEIGHT=240
        >
        <PARAM NAME="File" VALUE="/project3/bootcamp.ppz">
        <EMBED
        WIDTH=320 HEIGHT=240 SRC="/project3/bootcamp.ppz"
        >
        </EMBED>
        <NOEMBED>This page contains a Microsoft PowerPoint
        animation that your browser was unable to view.
        </NOEMBED>
        </OBJECT><P>
    <%EndIf%> 

Step 6

Finally, if the title contains the keyword script, the user is directed to the New Technology Solutions, Inc., web site. This link is installed in the same way as the previous link to the Microsoft web site. Add the following code to place this link in the web page:

    <%If idc.txtTitle CONTAINS "script"%>
        <FONT FACE="ARIAL" SIZE=3>
        For more information on VBScript,<BR>
        check out the <A HREF="http://www.vb-bootcamp.com">
        New Technology Solutions, Inc.,</A> web site!
        </FONT><P>
    <%EndIf%>

</CENTER>
</BODY>
</HTML> 

Your project is now complete! Save the file you created as purchase.htx in the \scripts\project3 folder with your other htx files. Figure 8-8 shows a sample confirmation page. Listing 8-4 shows the complete code, along with comments, for purchase.htx.

Figure 8-8.

A sample confirmation page.

<HTML>
<HEAD>
<TITLE>Thank You</TITLE>
</HEAD>

<BODY BGCOLOR="WHITE">
<CENTER>

<IMG SRC="/project3/thanks.gif" ALT="Thank you for your purchase"
WIDTH=450 HEIGHT=100><P>
<BR>

    <%If idc.txtTitle CONTAINS "database"%>
        <FONT FACE="ARIAL" SIZE=3>
        Check out these other hot titles on
        database development!<P>
        <A HREF="/scripts/project3/title.idc?txtTitle=
Applying+SQL+in+Business">
        Applying SQL in Business
        </A><P> 
        <A HREF="/scripts/project3/title.idc?txtTitle=
Paradox+made+easy">
        Paradox made easy
        </A><P>
        <A HREF="/scripts/project3/title.idc?txtTitle=
Oracle7;+the+complete+reference">
        Oracle7; the complete reference
        </A><P>
        </FONT>
    <%EndIf%>

    <%If idc.txtTitle CONTAINS "visual"%>
        <FONT FACE="ARIAL" SIZE=3>
        For more information on visual tools,<BR>
        check out the <A HREF="http://www.microsoft.com">
        Microsoft</A> web site!
        </FONT><P>
    <%EndIf%>

    <%If idc.txtTitle CONTAINS "programming"%>

        <!--
        This is a PowerPoint viewer control used
        to embed a PowerPoint presentation in the
        web page
        -->

        <OBJECT
        CLASSID="clsid:EFBD14F0-6BFB-11CF-9177-00805F8813FF"
        WIDTH=320
        HEIGHT=240
        >
        <PARAM NAME="File" VALUE="/project3/bootcamp.ppz">
        <EMBED
        WIDTH=320 HEIGHT=240 SRC="/project3/bootcamp.ppz"
        >
        </EMBED>
        <NOEMBED>This page contains a Microsoft PowerPoint
        animation that your browser was unable to view.
        </NOEMBED>
        </OBJECT><P>
    <%EndIf%> 

    <%If idc.txtTitle CONTAINS "script"%>
        <FONT FACE="ARIAL" SIZE=3>
        For more information on VBScript,<BR>
        check out the <A HREF="http://www.vb-bootcamp.com">
        New Technology Solutions, Inc.,</A> web site!
        </FONT><P>
    <%EndIf%>

</CENTER>
</BODY>
</HTML> 

Listing 8-4.

Confirmation page code in the purchase.htx file.

© 1996 by Scot Hillier. All rights reserved.