Creating search form

To enable search though the recordset we will add the search form and use joined tables so our visitor can search for author's and publisher's name instead of their ID. Please note that form fields with name starting with WBF_   are used to carry a value for specific database field. The name of the recordset field is specified after WBF_ prefix and it has to be exactly the same as in the database.

[FormFields]
wb_basename=biblio.mdb
WB_RcdSet=(select Title,[Year Published],ISBN,Authors.Name as Author,publishers.Name as Publisher,Authors.Name,publishers.Name from (Authors inner join titles on authors.au_id=titles.au_id) inner join publishers on publishers.pubid=titles.pubid)
WB_Command=Q
WB_MaxRec=10
WB_Order=[Year published] desc
<!--WB_BeginTemplate-->
<html>
<head>
<style>
.wbspttbl{
border:1px solid #000000;
font-family:verdana;
font-size:12px;
border-collapse:collapse;
border-spacing:0px;
}
.wbspthdr{
background-color:#CC0000;
border:1px solid #000000;
color:#C0C0C0;
}
.wbsptrow{
background-color:#FFCC00;
border:1px solid #000000;
color:#0000CC;
}
input, select, label{
width:150px;
font-family:verdana;
font-size:11px;
}
</style>
<title>Simple database example</title>
</head>
<body>
<form action="$wbe[script_name]"> #*comment: $wbe[script_name] will return the name of current wbsp file*#
<label for="year">Select year of publishing: </label>
<select name="WBF_Year published" size="1" id="year">#*comment: WBF_Year published form field will carry the search string for recordset field Year published*#
<option value="">ignore</option>
<option value="1996">1996</option>
<option value="1997">1997</option>
<option value="1998">1998</option>
<option value="1999">1999</option>
<option value="2000">2000</option>
<option value="2001">2001</option>
</select><br>
<label for="title">Title: </label>
<input type="text" size="20" id="title" name="wbf_title"><br>#*comment: WBF_title form field will carry the search string for recordset field title*#
<label for="author">Author: </label>
<input type="text" size="20" id="author" name="wbf_author"><br>#*comment: WBF_author form field will carry the search string for recordset field author*#
<label for="publisher">Publisher: </label>
<input type="text" size="20" id="publisher" name="wbf_publisher"><br>#*comment: WBF_publisher form field will carry the search string for recordset field publisher*#
<label for="AO">Return records that: </label>
<select name="WB_AndOr" size="1" id="AO">
<option value="AND">match all conditions</option>
<option value="OR">match any of the conditions</option>
</select><br>#*comment: Value of WB_AndOr form field will define if WhizBase will search for records that meet all conditions (And) or any condition (Or)*#
<input type="submit" name="sButt" value="Search">
</form>
$wbdetail[t]
</body>
</html>