Here is an explaination of the code

Please note that I will not go over any of the html tags.

<html>
<head>

{set page %theArgs% 'thedate' containsAnyString:}

	The line above creates a new variable called page.  Page is set to a true/false
value, by containsAnyString:.  This WebBase macro checks the global variable %theArgs%,
which contains all of the incoming variables and their values, to see if the string
'thedate' is present.  I use this function to test whether or not my variables are present,
because if they are not WebBase will output an error.

{if page false =}
	{set thedate 'nope'}
{/if}

	The {if .. /if} statement above checks to see if page is equal to false.  If it
is, then I know that my variable was not properly passed to the page, and I create and 
initialize it.  This keeps the following sql statement from producing an error.

{sql to answers source 'steva' user 'steva' password 'eva'}
Select * from exercise2 where compdate = '{ thedate }'
{/sql}

	This sql statement places the results of my query, the second line, into a new 
variable called answers.  If you perform more than one query in a form I would suggest
using a different variable name for each.  It accesses the ODBC connection source 'steva'.
It logs onto the system with user 'steva' password 'eva'.  The query
Select * from exercise2 where compdate = '{ thedate }' is then performed on the 
database.

{if 0 answers size = }

	The line above tests my results.  If answers has nothing in it, no query results, 
the size will be 0 and it will display the error page below.  If it has results it will 
jump to the code below the {else} statement.

	<title>Error</title>
	</head>
	<body>
	<h2>Sorry no results were returned for { thedate }.  Please try again
	and check to make sure the name is properly spelled(caps counts).</h2>
	<a href = "http://www.cs.pitt.edu/~hopeman/webbasexample.html">Return to Examples</a>


{else}>
	Perform this code if we have results.

	<title>Success!</title>
	</head>
	<body>
	<table align = center>
	<tr>
	<td>Name</td>
	<td>SSN</td>
	<td>Mod</td>
	<td>CompDate</td>
	<td>grade</td>
	</tr>

	{forRow currRow on answers}

		This code opens a basic loop.  This loop will walk through all of the 
	rows that are returned in on answers.  The keyword for the loop is forRow.
	It is case sensitive, as are all variables.  The currRow acts as a pointer to
	which row the loop is on, it can be any name you want ie. aRow, nextRow, etc.

	<tr>
	<td>{ NAME }</td>
	<td>{ SSN }</td>
	<td>{ MOD }</td>
	<td>{ COMPDATE }</td>
	<td>{ GRADE }</td>
	</tr>

	All of the bolded entries above are the attribute names returned by the Select *
as WebBase variables.  So that inside the loop for each row the attributes that are returned
can now be accessed.  You can even "set" a new variable to match the attribute that you want.
{set newvar NAME trimBlanks}  I used trimBlanks here to remove any extra blanks that are
returned as a part of the field, ie NAME is a varchar2 of size 20.  It would return 'John Doe            '.

	{/forRow}    Close the {forRow ..} tag

	</table>

	<table align = center>
	<a href = "http://www.cs.pitt.edu/~hopeman/webbasexample.html">Return to Examples</a>
	</table>

{/if}

Close the {if ..} tag.

</body>
</htmL>