
by Darrell Ticehurst and Keith Hilen
In the following sample application, the user
is required to enter both a first and last name. Once the names
are entered, a verification page is displayed. The user has the
option of accepting the entries or modifying them. When the verification
page is accepted, a thank you page is generated and displayed.
Three HTML templates are required: Entry, Verification,
and Thanks.
The Entry page has the following general appearance:

The HTML template source for this is as follows:
<HTML>
<FORM ACTION="\cgi-bin\entry?{system:sid}&1">
Please enter your name for our records. <P>
First Name: <INPUT TYPE="text" SIZE="30" MAXLEN="30"
NAME="firstname"
VALUE="{entry:firstname}"><P>
Last Name: <INPUT TYPE="text" SIZE="30" MAXLEN="30"
NAME="lastname"
VALUE="{entry:lastname}"><P>
<STRONG>{system:errormsg}</STRONG><P>
<INPUT TYPE="submit" NAME="_1" VALUE="Submit"><P>
</FORM>
</HTML>
Note that there are four tags surrounded by curly braces:
{system:sid}
{entry:firstname}
{entry:lastname}
{system:errormsg}
These tags are replaced with values in the
data set at the time the page is generated. system:sid is the
session ID which the system uses to match user entry to a particular
data set. entry:firstname and entry:lastname are self explanatory.
system:errormsg holds optional text describing an error condition.
The first generated screen has the following
source:
<HTML>
<FORM ACTION="\cgi-bin\entry?4503&1">
Please enter your name for our records. <P>
First Name: <INPUT TYPE="text" SIZE="30" MAXLEN="30"
NAME="firstname"
VALUE=""><P>
Last Name: <INPUT TYPE="text" SIZE="30" MAXLEN="30"
NAME="lastname"
VALUE=""><P>
<STRONG></STRONG><P>
<INPUT TYPE="submit" NAME="_1" VALUE="Submit"><P>
</FORM>
</HTML>
Note that there is no error message, and the
first and last name fields are blank. Now assume that the user
enters "Fred" into the first name field, leaving
the last name blank, and submits the data. The script \cgi-bin\entry
receives the data and stores it into the data set. The script
then determines that entry:lastname is blank. Based on that, it
sets system:errormsg to "You must enter all fields!"
and regenerates the same page. The new generated source is as
follows:
<HTML>
<FORM ACTION="\cgi-bin\entry?4503&1">
Please enter your name for our records. <P>
First Name: <INPUT TYPE="text" SIZE="30" MAXLEN="30"
NAME="firstname"
VALUE="Fred"><P>
Last Name: <INPUT TYPE="text" SIZE="30" MAXLEN="30"
NAME="lastname"
VALUE=""><P>
<STRONG>You must enter all fields!</STRONG><P>
<INPUT TYPE="submit" NAME="_1" VALUE="Submit"><P>
</FORM>
</HTML>
Note that the value "Fred" was
placed in the first entry control, and that there is now an
error message displayed at the bottom of the form. At the time
the page was generated, these fields were extracted from the data
set and inserted into the HTML output stream. The user sees this:
Assume the user now correctly enters his last
name, "Flintstone" and submits the data. The script
now determines that it can proceed, and generates the Verification
page. This page looks like this:
The template source is as follows:
<HTML>
<FORM ACTION="\cgi-bin\entry?{system:sid}&2">
Please verify that the following information is correct: <P>
First Name: {entry:firstname}<P>
Last Name: {entry:lastname}<P>
<INPUT TYPE="submit" NAME="_1" VALUE="Accept">
<INPUT TYPE="submit" NAME="_2"
VALUE="Change"><P>
</FORM>
</HTML>
This is expanded to:
<HTML>
<FORM ACTION="\cgi-bin\entry?4503&2">
Please verify that the following information is correct: <P>
First Name: Fred<P>
Last Name: Flintstone<P>
<INPUT TYPE="submit" NAME="_1" VALUE="Accept">
<INPUT TYPE="submit" NAME="_2"
VALUE="Change"><P>
</FORM>
</HTML>
When the user presses one of the buttons, the
script determines which action was taken and either regenerates
the entry page or generates the Thank You page. The latter has
the following source:
<HTML>
Thanks for registering with us, {entry:firstname}.<P>
</HTML>
Our user sees the following:

Copyright © 1996 Miller Freeman, Inc. ALL RIGHTS RESERVED
Please send questions or comments about this Web site to mfrank@mfi.com
Updated Tuesday, April 9, 1996