navigation
a webmaster learning community
     Home    Register     Search      Help      Login    
FrontPage Alternative
Sponsors

Shopping Cart Software
Ecommerce software integrated into Frontpage, Dreamweaver and Golive templates. No monthly fees and available in ASP and PHP versions.

Website Templates
We also have a wide selection of Dreamweaver, Expression Web and Frontpage templates as well as webmaster tools and CSS layouts.

Frontpage website templates
Creative Website Templates for FrontPage, Dreamweaver, Flash, SwishMax

Search Forums
 

Advanced search
Recent Posts

 Todays Posts
 Most Active posts
 Posts since last visit
 My Recent Posts
 Mark posts read

 

4 Search Check Boxes

 
View related threads: (in this forum | in all forums)

Logged in as: Guest
Users viewing this topic: none
Printable Version 

All Forums >> Web Development >> ASP and Database >> 4 Search Check Boxes
Page: [1]
 
Chugachman

 

Posts: 63
Joined: 2/8/2004
From: Alaska
Status: offline

 
4 Search Check Boxes - 3/7/2004 13:51:11   
I really tried to do this one on my own but nothing worked. This is the last search form and then I'm done. Jeezum-this is first thing I ever did on a computer that I just couldn't get!

Anyway, the last search is for special features on a trail (cabins, glaciers, biking, x-country skiing). In the database they are either Y or N.

I want to have a checkbox for each one with the value being Y if checked.

So...

If I use an AND between them, I will get an error about not having default values if some aren't checked. If I use OR it will not filter for each value (ie: if I choose Cabin and Glacier it won't give me trails that are both but will give me if either).

I'm assuming I use the "Where INSTR" but I'm not sure how to write the code when I have 4 different database fields as opposed to the one when I was just doing difficulty.
Richard Dudley

 

Posts: 668
Joined: 8/22/2002
From: Butler, PA
Status: offline

 
RE: 4 Search Check Boxes - 3/7/2004 14:55:40   
Are you using a stored procedure? If so, there is a slightly better way to do this. At any rate, you can build your SQL statement dynamically. Start with your basic SQL, like:

strSQL = "select * from sometable where length=..."

Add features conditions dynamically with a series of if...then statements:

if
request.form("cabins") = true
then
sql = sql + " and cabins=-1 "
end if

(use -1 for true if this is an Access DB and the fields are checkboxes--otherwise use whatever value you have in that field)

Hope this helps!

_____________________________

I need to change my avatar--the puppy is full grown now!

(in reply to Chugachman)
Page:   [1]

All Forums >> Web Development >> ASP and Database >> 4 Search Check Boxes
Page: [1]
Jump to: 1





New Messages No New Messages
Hot Topic w/ New Messages Hot Topic w/o New Messages
Locked w/ New Messages Locked w/o New Messages
 Post New Thread
 Reply to Message
 Post New Poll
 Submit Vote
 Delete My Own Post
 Delete My Own Thread
 Rate Posts