Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

using checkboxes to pass parameters

Status
Not open for further replies.

meltingpot

Technical User
May 11, 2004
118
0
0
GB
Im trying to write a query using 4 checkboxes (true or false).

I have 4 vechicle types , bike, car, van, lorry and would like the user to search for these items using the check boxes, multi selecting the types, so when they check the box (true)they include it in the result set, not checked then not included .

The very simple query …
Result.asp

SELECT bike, car, van, lorry
FROM vehicle
WHERE bike = bike AND car = car AND van = van AND lorry = lorry (this is where I don’t know how use the checkboxes)


Query_vehicle.asp sends these over to the above page

Request.QueryString("bike") check box name

Request.QueryString("car")

Request.QueryString("van")

Request.QueryString("lorry")

Using MS Access 2003 and ASP vbscript

Any ideas ? ?
 
Assuming the names of a few things you need to have this sort of code:

strexec = "select * from vehicle where "
if request.form("selbike") = "on" then
strexec = strexec & "vehicletype = 'bike' "
sel1 = "y"
end if
if request.form("selcar") = "on" then
if sel1 = "y" then
strexec = strexec & " or "
strexec = strexec & "vehicletype = 'bike' "
sel1 = "y"
end if
...
Then open your recordset with strexec.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top