-
hi all a total newbie here first week with this stuff.
I got a html form that passes info to asp page.
select name="price"
option value="200" $0-$200 /option
option value="400" $200-$400 /option
/select
SQL = "SELECT * FROM table WHERE price<"&Request.Form("price")&"
if select option value="400" it shows all items less than 400 when i only want to display items from 200-400.
Is this making sense. Do i need some vb script somewhere to make this work or is the SQL wrong
Cheers
newbie
-
Hi micksterbooty
As long as the value's are always incrementing by 200 you can use the following
Dim selectvalue
selectvalue = Cint(Request.Form("price"))
SQL = "SELECT * FROM table " & _
"WHERE price>=" & (selectvalue - 200) & "AND price <= " & selectvalue
hope it helps
Ian
-
cheers ian it works a treat.
I tried adding another condition to the WHERE
but getting confused with syntax
SQL = "SELECT * FROM surfboardtable " & _
"WHERE price>=" & (selectvalue - 200) & "AND price <= " & selectvalue
AND state='"&Request.Form("state")&"'
thanks again
mick
-
This is what you need. the _ is just to include the string on the next line just use the following
Code:
SQL = "SELECT * FROM surfboardtable WHERE price >= " & (selectvalue - 200) & " AND price <= " & selectvalue & " AND state='"&Request.Form("state") &"'"
Hope it helps
Ian
-
cheers ian you are a legend.