|
 |
asp_discuss thread: ASP to create multiple choice questionnaire connected to a db
Message #1 by stephen_marrs@h... on Thu, 22 Aug 2002 08:52:37
|
|
Hello,Could anyone help. Ineed to create a multiple choice questionnaire
that uses ASP to allow users to choose between different criteria which
will query a db and return a list of suitable dog breeds to them using
ASP and JavaScript. The criteria are Size,Grooming,Exercise and Space and
each of these has the following attributes to choose from,e.g.Considerable
(Con),Moderate(Mod) or Little(Lt)and in the case of size S,M,L and XL.
This is what I have come up with so far
<%@ LANGUAGE = JavaScript%>
<HTML>
<BODY>
<h3>Dog Breed Selector</h3>
<p>Please choose what Size of dog you would prefer:</p>
<form>
<table>
<td><input type='radio' name='size' value='S'>Small</td>
<td><input type='radio' name='size' value='M'>Medium</td>
<td><input type='radio' name='size' value='L'>Large</td>
<td><input type='submit' value='Find a Dog'></td>
<%
// Open connection to database, then populate a recordset with list of
stock
var adoConnection = Server.CreateObject("ADODB.Connection");
var adoRecordSet;
var mySQL;
adoConnection.Open("DSN=DogDSN");
var mySQL = "SELECT BreedName" +
" FROM Breeds WHERE Size='" & Request.Form('size')&"'";
adoRecordSet = adoConnection.Execute(mySQL);
// Loop through recordset and write Breed Names out to page
while ( adoRecordSet.Eof == false )
{
%>
<TR>
<TD><%=adoRecordSet("BreedName").Value%></TD>
</TR>
<%
adoRecordSet.MoveNext();
}
// Close Recordset and connections
// and release memory used by Recordset and Connection objects
adoRecordSet.Close();
adoRecordSet = null;
adoConnection.Close();
adoConnection = null;
%>
<%Response.Write(Request.Form("size"))
%>
</BODY>
What would I need to change and add to this to meet my requirements?
|
|
 |