473,385 Members | 1,642 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

How to write a query that allows multiple input from a select list

37
I have a select list that allows me to filter the results of a database search.
The user chooses from a dropdown menu then clicks submit.
The target page shows only the records containing what was chosen from the list.
What I would like is to allow the user to choose multiple items from the
list while holding down the ctrl key, then filter the search results based on what was chosen.

Can you tell me how to change the syntax on my target page query so that is allows multiple input.

something like -

WHERE titles.level_id IN (1,2,3,4)

This is the current query
Expand|Select|Wrap|Line Numbers
  1. $query_rsTitles = "SELECT id, title, company, `description`, resources, location, url, image, keyword, copies FROM titles WHERE titles.level_id = ". GetSQLValueString($_POST['softwareLevel'], "int") ." ORDER BY id ASC";
This is the menu code -

Expand|Select|Wrap|Line Numbers
  1. <select name="softwareLevel[]" id="softwareLevel">
  2.           <?php
  3.   do {  
  4.   ?>
  5.           <option value="<?php echo $row_rs_level['level_id']?>"><?php echo $row_rs_level['level']?></option>
  6.         <?php
  7.   } while ($row_rs_level = mysql_fetch_assoc($rs_level));
  8.     $rows = mysql_num_rows($rs_level);
  9.    if($rows > 0) {
  10.       mysql_data_seek($rs_level, 0);
  11.       $row_rs_level = mysql_fetch_assoc($rs_level);
  12.    }
  13.  ?>
  14.   </select>
  15.  
Aug 3 '11 #1
0 1171

Sign in to post your reply or Sign up for a free account.

Similar topics

1
by: Burton Figg | last post by:
I have a SELECT statement which holds a list of times (for adding appointments to a database): e.g. <select name="time" id="time" size="3" multiple> <option value="00:00">00:00</option>...
1
by: | last post by:
Hi guys, i have a multiple select list box on my form, and it saves the selections I make into the field just fine., but when i open the form on an existing record, it does not show up the...
3
by: syounger | last post by:
Hi. I have a report in Access 2000 that is based on selection made from a series of interdependent list boxes. The boxes I have right now are Source, Table, Column, Date. The user chooses Source...
1
by: theSquid | last post by:
I am trying to sort through data in one table using the criteria selected on a form in a few multi-select list boxes. Each list box would be used to sort a different field in the table. The...
4
by: rn5a | last post by:
A Form has 2 select lists. The 1st one whose size is 5 (meaning 5 options are shown at any given time) allows multiple selection whereas the 2nd one allows only 1 option to be selected at a time. ...
12
by: micarl | last post by:
How would i print a report based on criteria selected from several Combo Boxes as well as multiple Multi Select List Boxes, that are located on the same form? I can get one Multi List Box, just...
11
by: woodey2002 | last post by:
This problem is driving me crazy. Hello there, i am trying to create a search form for records in my access database. The search form will contain text boxes and a multi select list box. The user...
6
by: woodey2002 | last post by:
Hi Everyone. Thanks for your time. I am trying to create a search form that will allow users to select criteria from multiple multi select boxes. So far i have managed to achieve a search option...
1
by: woodey2002 | last post by:
Hi Everyone and many thanks for your time.. I am trying to begin access and a bit of VBA i am enjoying it but I have a annoying problem I just can’t get any where on. My databse mostly includes...
1
by: kstevens | last post by:
I am trying to pull time records for employees. I have a list box (simple multi select) with there names in the box. I want people to be able to select the employees that they want, and click the...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.