Select using multiple checkboxes

Results 1 to 2 of 2

Thread: Select using multiple checkboxes

  1. #1
    Ramprasad Guest

    Default Select using multiple checkboxes

    I have a list of check boxes generated from a table of hobbies in a database.<BR>I want to select a recordset from another table of personal details using the checked option in the above checkboxes.<BR><BR>the personal details and the hobbies table are linked using an intermediate table which links the userid and the hobby id (since it is a one to many relation).<BR><BR>Kindly help me with the select statement. I do naot know how many checkboxes will be generated from the hobbies table as it will be dynamic and the no of hobbies can change any moment of time.<BR><BR>Thanks in advance<BR>

  2. #2
    Join Date
    Dec 1969

    Default RE: Select using multiple checkboxes

    If you name all the check boxes the same and give each one a different value then on the response page when you call the value of the check box you will get an object array like<BR><BR>say there are 3 checkboxes named hobbies <BR>1-basball<BR>2-basketball<BR>3 soccer<BR><BR>if the users selects <BR><BR>1 and three you will get an array like<BR><BR>baseball, soccer<BR><BR>then you can do a replace on that value to change the , to sql<BR><BR>VarWhere=Replace(Request.form(Hobbies") ,",", "&#039 Or Hobbies=&#039")<BR><BR>Sql="Select * from Table Where Hobbies=&#039" & VarWhere & "&#039;"<BR><BR>you would get<BR><BR>Select * from Table Where Hobbies=&#039baseball&#039 or Hobbies=&#039soccer&#039;"<BR><BR>

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts