PDA

View Full Version : Drop Down Selection


details
10-18-2002, 05:36 PM
<select name="intPrice">
<option value="all">All Price Levels
<option value="= 40 OR <350">Under $350
<option value="500"> Under $500
<option value="750"> Under $750
<option value="1000"> Under $1000
</select>

What is proper syntax for between 50 and 350

BigDaddy
10-18-2002, 08:30 PM
Do you mean:

IF intPrice > 50 and intPrice < 350 then...

whammy
10-19-2002, 12:35 AM
I'd probably do something like:


<select name="intPrice">
<option value="1">All Price Levels
<option value="2">Under $350
<option value="3"> Under $500
<option value="4"> Under $750
<option value="5"> Under $1000
</select>

and in your ASP:

<%
Dim Conn, rs, QString, intPrice

intPrice = Request.Form("intPrice")

'Put your connection code here or whatever

If intPrice <> "" Then

Select Case intPrice
Case "1"
QString = "SELECT * FROM Tablename"
Case "2"
QString = "SELECT * FROM Tablename WHERE Price < 350"
Case "3"
QString = "SELECT * FROM Tablename WHERE Price < 500"
Case "4"
QString = "SELECT * FROM Tablename WHERE Price < 750"
Case "5"
QString = "SELECT * FROM Tablename WHERE Price < 1000"
End Select

Set rs = Conn.Execute(QString)

If NOT rs.EOF
Do While NOT rs.EOF
'Display your records here
rs.MoveNext
Loop
Else
Response.Write("No records found." & vbLf)
End If

Else

'Tell the user they need to enter a Price

End If
%>


As a basic example... of course, you could build most of the querystring, and have the Select statement then build part of the querystring value for you as well...