I have a form that pulls category name from a database (category table). The cat names populate a multiple select box. The values of the options are:
categoryID & categoryName
Ok so far:
I have a products table with relevant columns named productID, categoryID, and productName.
What is killing me is that i CANNOT figure out how to get multple products with different categoryID's to come up from selections in the select box. I can do it with one selection, but not with 2 or more.
Thanks, koncept, yes.....but...i really dont know how to explain it other than this....
how do i get that into query?
select * from products where categoryID = ??????
this is where im stuck...I dont want to hard code the query...i want to have it take what the person choses in the multiple select and have it inserted into the query....ie:
if a person choses 3 categories from the multiple select, how do i get those values into the query?
I can do it with one value, easy enough:
select * from products where catalogID = request.form("cats")
OK, your saying that someone selects something from a select box and that in turn loads a value into the query and runs the query.
Well when you submit your form have its action set to :
thanks for all the help guys. I guess I should post the code of what i want so here goes :
this is the page with the multiple select box
right now it only has a standard select, but i want/need to change it to a multiple select box so customers can choose multiple categories and then display that result with quantity boxes beside each record via a repeat region.
this page works fine with one category selected but not with multiple categories. This is what i dont know how to do with the query.
The recordset "cats" populates the select box:
The recordset "prods" returns products that have a catalogID of x that is passed by querystring ( catalogID=1, etc)
The recordset "info" is just misc info about the category taken from the category table.
I have tried converting this single selet to a multiple select but cant get the code right to accomplish this task.
By the way, thanks for all the help so far
Code:
<%@LANGUAGE="VBSCRIPT" CODEPAGE="1252"%>
<%
Response.Expires = 60
Response.Expiresabsolute = Now() - 1
Response.AddHeader "pragma","no-cache"
Response.AddHeader "cache-control","private"
Response.CacheControl = "no-cache"
%>
<!--#include file="Connections/profile.asp" -->
<%
Dim rsCats
Dim rsCats_numRows
Set rsCats = Server.CreateObject("ADODB.Recordset")
rsCats.ActiveConnection = MM_profile_STRING
rsCats.Source = "SELECT * FROM vanprods ORDER BY catalogName ASC"
rsCats.CursorType = 0
rsCats.CursorLocation = 2
rsCats.LockType = 1
rsCats.Open()
rsCats_numRows = 0
%>
<%
Dim rsProds__MMColParam
rsProds__MMColParam = "1"
If (Request.QueryString("catalogID") <> "") Then
rsProds__MMColParam = Request.QueryString("catalogID")
End If
%>
<%
Dim rsProds
Dim rsProds_numRows
Set rsProds = Server.CreateObject("ADODB.Recordset")
rsProds.ActiveConnection = MM_profile_STRING
rsProds.Source = "SELECT * FROM products WHERE catalogID = '" + Replace(rsProds__MMColParam, "'", "''") + "'"
rsProds.CursorType = 0
rsProds.CursorLocation = 2
rsProds.LockType = 1
rsProds.Open()
rsProds_numRows = 0
%>
<%
Dim rsInfo__MMColParam
rsInfo__MMColParam = "1"
If (Request.QueryString("catalogId") <> "") Then
rsInfo__MMColParam = Request.QueryString("catalogId")
End If
%>
<%
Dim rsInfo
Dim rsInfo_numRows
Set rsInfo = Server.CreateObject("ADODB.Recordset")
rsInfo.ActiveConnection = MM_profile_STRING
rsInfo.Source = "SELECT * FROM vanprods WHERE catalogId = '" + Replace(rsInfo__MMColParam, "'", "''") + "'"
rsInfo.CursorType = 0
rsInfo.CursorLocation = 2
rsInfo.LockType = 1
rsInfo.Open()
rsInfo_numRows = 0
%>
<%
Dim Repeat1__numRows
Dim Repeat1__index
Repeat1__numRows = 15
Repeat1__index = 0
rsProds_numRows = rsProds_numRows + Repeat1__numRows
%>
<%
' *** Recordset Stats, Move To Record, and Go To Record: declare stats variables
Dim rsProds_total
Dim rsProds_first
Dim rsProds_last
' set the record count
rsProds_total = rsProds.RecordCount
' set the number of rows displayed on this page
If (rsProds_numRows < 0) Then
rsProds_numRows = rsProds_total
Elseif (rsProds_numRows = 0) Then
rsProds_numRows = 1
End If
' set the first and last displayed record
rsProds_first = 1
rsProds_last = rsProds_first + rsProds_numRows - 1
' if we have the correct record count, check the other stats
If (rsProds_total <> -1) Then
If (rsProds_first > rsProds_total) Then
rsProds_first = rsProds_total
End If
If (rsProds_last > rsProds_total) Then
rsProds_last = rsProds_total
End If
If (rsProds_numRows > rsProds_total) Then
rsProds_numRows = rsProds_total
End If
End If
%>
<%
' *** Recordset Stats: if we don't know the record count, manually count them
If (rsProds_total = -1) Then
' count the total records by iterating through the recordset
rsProds_total=0
While (Not rsProds.EOF)
rsProds_total = rsProds_total + 1
rsProds.MoveNext
Wend
' reset the cursor to the beginning
If (rsProds.CursorType > 0) Then
rsProds.MoveFirst
Else
rsProds.Requery
End If
' set the number of rows displayed on this page
If (rsProds_numRows < 0 Or rsProds_numRows > rsProds_total) Then
rsProds_numRows = rsProds_total
End If
' set the first and last displayed record
rsProds_first = 1
rsProds_last = rsProds_first + rsProds_numRows - 1
If (rsProds_first > rsProds_total) Then
rsProds_first = rsProds_total
End If
If (rsProds_last > rsProds_total) Then
rsProds_last = rsProds_total
End If
End If
%>
<%
Dim MM_paramName
%>
<%
' *** Move To Record and Go To Record: declare variables
Dim MM_rs
Dim MM_rsCount
Dim MM_size
Dim MM_uniqueCol
Dim MM_offset
Dim MM_atTotal
Dim MM_paramIsDefined
Dim MM_param
Dim MM_index
Set MM_rs = rsProds
MM_rsCount = rsProds_total
MM_size = rsProds_numRows
MM_uniqueCol = ""
MM_paramName = ""
MM_offset = 0
MM_atTotal = false
MM_paramIsDefined = false
If (MM_paramName <> "") Then
MM_paramIsDefined = (Request.QueryString(MM_paramName) <> "")
End If
%>
<%
' *** Move To Record: handle 'index' or 'offset' parameter
if (Not MM_paramIsDefined And MM_rsCount <> 0) then
' use index parameter if defined, otherwise use offset parameter
MM_param = Request.QueryString("index")
If (MM_param = "") Then
MM_param = Request.QueryString("offset")
End If
If (MM_param <> "") Then
MM_offset = Int(MM_param)
End If
' if we have a record count, check if we are past the end of the recordset
If (MM_rsCount <> -1) Then
If (MM_offset >= MM_rsCount Or MM_offset = -1) Then ' past end or move last
If ((MM_rsCount Mod MM_size) > 0) Then ' last page not a full repeat region
MM_offset = MM_rsCount - (MM_rsCount Mod MM_size)
Else
MM_offset = MM_rsCount - MM_size
End If
End If
End If
' move the cursor to the selected record
MM_index = 0
While ((Not MM_rs.EOF) And (MM_index < MM_offset Or MM_offset = -1))
MM_rs.MoveNext
MM_index = MM_index + 1
Wend
If (MM_rs.EOF) Then
MM_offset = MM_index ' set MM_offset to the last possible record
End If
End If
%>
<%
' *** Move To Record: if we dont know the record count, check the display range
If (MM_rsCount = -1) Then
' walk to the end of the display range for this page
MM_index = MM_offset
While (Not MM_rs.EOF And (MM_size < 0 Or MM_index < MM_offset + MM_size))
MM_rs.MoveNext
MM_index = MM_index + 1
Wend
' if we walked off the end of the recordset, set MM_rsCount and MM_size
If (MM_rs.EOF) Then
MM_rsCount = MM_index
If (MM_size < 0 Or MM_size > MM_rsCount) Then
MM_size = MM_rsCount
End If
End If
' if we walked off the end, set the offset based on page size
If (MM_rs.EOF And Not MM_paramIsDefined) Then
If (MM_offset > MM_rsCount - MM_size Or MM_offset = -1) Then
If ((MM_rsCount Mod MM_size) > 0) Then
MM_offset = MM_rsCount - (MM_rsCount Mod MM_size)
Else
MM_offset = MM_rsCount - MM_size
End If
End If
End If
' reset the cursor to the beginning
If (MM_rs.CursorType > 0) Then
MM_rs.MoveFirst
Else
MM_rs.Requery
End If
' move the cursor to the selected record
MM_index = 0
While (Not MM_rs.EOF And MM_index < MM_offset)
MM_rs.MoveNext
MM_index = MM_index + 1
Wend
End If
%>
<%
' *** Move To Record: update recordset stats
' set the first and last displayed record
rsProds_first = MM_offset + 1
rsProds_last = MM_offset + MM_size
If (MM_rsCount <> -1) Then
If (rsProds_first > MM_rsCount) Then
rsProds_first = MM_rsCount
End If
If (rsProds_last > MM_rsCount) Then
rsProds_last = MM_rsCount
End If
End If
' set the boolean used by hide region to check if we are on the last record
MM_atTotal = (MM_rsCount <> -1 And MM_offset + MM_size >= MM_rsCount)
%>
<%
' *** Go To Record and Move To Record: create strings for maintaining URL and Form parameters
Dim MM_keepNone
Dim MM_keepURL
Dim MM_keepForm
Dim MM_keepBoth
Dim MM_removeList
Dim MM_item
Dim MM_nextItem
' create the list of parameters which should not be maintained
MM_removeList = "&index="
If (MM_paramName <> "") Then
MM_removeList = MM_removeList & "&" & MM_paramName & "="
End If
MM_keepURL=""
MM_keepForm=""
MM_keepBoth=""
MM_keepNone=""
' add the URL parameters to the MM_keepURL string
For Each MM_item In Request.QueryString
MM_nextItem = "&" & MM_item & "="
If (InStr(1,MM_removeList,MM_nextItem,1) = 0) Then
MM_keepURL = MM_keepURL & MM_nextItem & Server.URLencode(Request.QueryString(MM_item))
End If
Next
' add the Form variables to the MM_keepForm string
For Each MM_item In Request.Form
MM_nextItem = "&" & MM_item & "="
If (InStr(1,MM_removeList,MM_nextItem,1) = 0) Then
MM_keepForm = MM_keepForm & MM_nextItem & Server.URLencode(Request.Form(MM_item))
End If
Next
' create the Form + URL string and remove the intial '&' from each of the strings
MM_keepBoth = MM_keepURL & MM_keepForm
If (MM_keepBoth <> "") Then
MM_keepBoth = Right(MM_keepBoth, Len(MM_keepBoth) - 1)
End If
If (MM_keepURL <> "") Then
MM_keepURL = Right(MM_keepURL, Len(MM_keepURL) - 1)
End If
If (MM_keepForm <> "") Then
MM_keepForm = Right(MM_keepForm, Len(MM_keepForm) - 1)
End If
' a utility function used for adding additional parameters to these strings
Function MM_joinChar(firstItem)
If (firstItem <> "") Then
MM_joinChar = "&"
Else
MM_joinChar = ""
End If
End Function
%>
<%
' *** Move To Record: set the strings for the first, last, next, and previous links
Dim MM_keepMove
Dim MM_moveParam
Dim MM_moveFirst
Dim MM_moveLast
Dim MM_moveNext
Dim MM_movePrev
Dim MM_urlStr
Dim MM_paramList
Dim MM_paramIndex
Dim MM_nextParam
MM_keepMove = MM_keepBoth
MM_moveParam = "index"
' if the page has a repeated region, remove 'offset' from the maintained parameters
If (MM_size > 1) Then
MM_moveParam = "offset"
If (MM_keepMove <> "") Then
MM_paramList = Split(MM_keepMove, "&")
MM_keepMove = ""
For MM_paramIndex = 0 To UBound(MM_paramList)
MM_nextParam = Left(MM_paramList(MM_paramIndex), InStr(MM_paramList(MM_paramIndex),"=") - 1)
If (StrComp(MM_nextParam,MM_moveParam,1) <> 0) Then
MM_keepMove = MM_keepMove & "&" & MM_paramList(MM_paramIndex)
End If
Next
If (MM_keepMove <> "") Then
MM_keepMove = Right(MM_keepMove, Len(MM_keepMove) - 1)
End If
End If
End If
' set the strings for the move to links
If (MM_keepMove <> "") Then
MM_keepMove = MM_keepMove & "&"
End If
MM_urlStr = Request.ServerVariables("URL") & "?" & MM_keepMove & MM_moveParam & "="
MM_moveFirst = MM_urlStr & "0"
MM_moveLast = MM_urlStr & "-1"
MM_moveNext = MM_urlStr & CStr(MM_offset + MM_size)
If (MM_offset - MM_size < 0) Then
MM_movePrev = MM_urlStr & "0"
Else
MM_movePrev = MM_urlStr & CStr(MM_offset - MM_size)
End If
%>
<html>
<head>
<title>Untitled Document</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<!--#include file="cart/include/NC_debug.asp" -->
<!--#include file="cart/include/NC_settings.asp" -->
<!--#include file="cart/include/NebuCart.asp" -->
<!--#include file="cart/include/NC_formatting.asp" -->
<!--#include file="cart/include/NC_multi-add.asp" -->
<script language="JavaScript">
function jumptolink(what){
var selectedopt=what.options[what.selectedIndex]
window.location=selectedopt.value
}
</script>
<script language="JavaScript" type="text/JavaScript">
<!--
function GP_AdvOpenWindow(theURL,winName,features,popWidth,popHeight,winAlign,ignorelink,alwaysOnTop,autoCloseTime,borderless) { //v2.0
var leftPos=0,topPos=0,autoCloseTimeoutHandle, ontopIntervalHandle, w = 480, h = 340;
if (popWidth > 0) features += (features.length > 0 ? ',' : '') + 'width=' + popWidth;
if (popHeight > 0) features += (features.length > 0 ? ',' : '') + 'height=' + popHeight;
if (winAlign && winAlign != "" && popWidth > 0 && popHeight > 0) {
if (document.all || document.layers || document.getElementById) {w = screen.availWidth; h = screen.availHeight;}
if (winAlign.indexOf("center") != -1) {topPos = (h-popHeight)/2;leftPos = (w-popWidth)/2;}
if (winAlign.indexOf("bottom") != -1) topPos = h-popHeight; if (winAlign.indexOf("right") != -1) leftPos = w-popWidth;
if (winAlign.indexOf("left") != -1) leftPos = 0; if (winAlign.indexOf("top") != -1) topPos = 0;
features += (features.length > 0 ? ',' : '') + 'top=' + topPos+',left='+leftPos;}
if (document.all && borderless && borderless != "" && features.indexOf("fullscreen") != -1) features+=",fullscreen=1";
if (window["popupWindow"] == null) window["popupWindow"] = new Array();
var wp = popupWindow.length;
popupWindow[wp] = window.open(theURL,winName,features);
if (popupWindow[wp].opener == null) popupWindow[wp].opener = self;
if (document.all || document.layers || document.getElementById) {
if (borderless && borderless != "") {popupWindow[wp].resizeTo(popWidth,popHeight); popupWindow[wp].moveTo(leftPos, topPos);}
if (alwaysOnTop && alwaysOnTop != "") {
ontopIntervalHandle = popupWindow[wp].setInterval("window.focus();", 50);
popupWindow[wp].document.body.onload = function() {window.setInterval("window.focus();", 50);}; }
if (autoCloseTime && autoCloseTime > 0) {
popupWindow[wp].document.body.onbeforeunload = function() {
if (autoCloseTimeoutHandle) window.clearInterval(autoCloseTimeoutHandle);
window.onbeforeunload = null; }
autoCloseTimeoutHandle = window.setTimeout("popupWindow["+wp+"].close()", autoCloseTime * 1000); }
window.onbeforeunload = function() {for (var i=0;i<popupWindow.length;i++) popupWindow[i].close();}; }
document.MM_returnValue = (ignorelink && ignorelink != "") ? false : true;
}
//-->
</script>
<link rel="stylesheet" href="cart/nebucart.css">
</head>
<BODY onLoad="cacheOff()"><br>
<STYLE TYPE="text/css">
<!--
#cache {
position:absolute; top:300px; left=:300px; z-index:10; visibility:hidden;
}
-->
</STYLE>
<!--
Lines above are creating a layer which show a message
displaying the 'PLEASE WAIT ... ' message
-->
<SCRIPT LANGUAGE="JavaScript">
ver = navigator.appVersion.substring(0,1)
if (ver >= 4)
{
document.write('<DIV ID="cache"><TABLE WIDTH=400 BGCOLOR=#000000 BORDER=0 CELLPADDING=2 CELLSPACING=0><TR><TD ALIGN=center VALIGN=middle><TABLE WIDTH=100% BGCOLOR=#FFFFFF BORDER=0 CELLPADDING=0 CELLSPACING=0><TR><TD ALIGN=center VALIGN=middle><FONT FACE="Arial, Verdana" SIZE=4><B><BR>LOADING, PLEASE WAIT...<img src="images/spinner.gif"><BR><BR></B></FONT></TD> </TR></TABLE></TD> </TR></TABLE></DIV>');
var navi = (navigator.appName == "Netscape" && parseInt(navigator.appVersion) >= 4);
var HIDDEN = (navi) ? 'hide' : 'hidden';
var VISIBLE = (navi) ? 'show' : 'visible';
var cache = (navi) ? document.cache : document.all.cache.style;
largeur = screen.width;
cache.left = Math.round(100);
cache.visibility = VISIBLE;
}
function cacheOff()
{
if (ver >= 4)
{
cache.visibility = HIDDEN;
}
}
</SCRIPT>
<form name="form1">
<select name="cats" onChange="jumptolink(document.form1.cats)">
<option value="" selected>---Select Your Stone---</option>
<%
While (NOT rsCats.EOF)
%>
<option value="cat.asp?catalogID=<%=(rsCats.Fields.Item("catalogId").Value)%>"><%=(rsCats.Fields.Item("catalogName").Value)%></option>
<%
rsCats.MoveNext()
Wend
If (rsCats.CursorType > 0) Then
rsCats.MoveFirst
Else
rsCats.Requery
End If
%>
</select><br><br>
<a href="cart/cart.asp">View Current Order</a>
</form>
<form name="NC_form">
<% If Not rsProds.EOF Or Not rsProds.BOF Then %>
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td colspan="6"> <table width="100%" border="0" cellspacing="3" cellpadding="3">
<tr>
<td width="33%" rowspan="5" valign="top"> <p><font size="2" face="Verdana, Arial, Helvetica, sans-serif"><strong><%=(rsInfo.Fields.Item("catalogName").Value)%></strong></font></p>
<p><font size="2" face="Verdana, Arial, Helvetica, sans-serif"><strong><img src="<%=(rsInfo.Fields.Item("cat_pic").Value)%>" alt="" width="125" hspace="3"></strong></font></p></td>
<td width="13%"><font color="#990000" size="2" face="Verdana, Arial, Helvetica, sans-serif">Texture</font></td>
<td width="54%"><font size="2" face="Verdana, Arial, Helvetica, sans-serif">
<% if rsInfo("texture") <> "" then %>
<%=(rsInfo.Fields.Item("texture").Value)%>
<% else %>
No Data...
<% end if %>
</font></td>
</tr>
<tr>
<td><font color="#990000" size="2" face="Verdana, Arial, Helvetica, sans-serif">Size</font></td>
<td><font size="2" face="Verdana, Arial, Helvetica, sans-serif">
<% if rsInfo("SIZE") <> "" then %>
<%=(rsInfo.Fields.Item("SIZE").Value)%>
<% else %>
No Data...
<% end if %>
</font></td>
</tr>
<tr>
<td><font color="#990000" size="2" face="Verdana, Arial, Helvetica, sans-serif">Coverage</font></td>
<td><font size="2" face="Verdana, Arial, Helvetica, sans-serif">
<% if rsInfo("COVERAGE") <> "" then %>
<%=(rsInfo.Fields.Item("COVERAGE").Value)%>
<% else %>
No Data...
<% end if %>
</font></td>
</tr>
<tr>
<td><font color="#990000" size="2" face="Verdana, Arial, Helvetica, sans-serif">Extra
Info</font></td>
<td><font size="2" face="Verdana, Arial, Helvetica, sans-serif">
<% if rsInfo("coverage2") <> "" then %>
<%=(rsInfo.Fields.Item("coverage2").Value)%>
<% else %>
No Data...
<% end if %>
</font></td>
</tr>
</table>
<br> <table border="0" width="50%">
<tr>
<td width="23%"> <font size="2">
<% If MM_offset <> 0 Then %>
<a href="<%=MM_moveFirst%>">First</a>
<% End If ' end MM_offset <> 0 %>
</font></td>
<td width="31%"> <font size="2">
<% If MM_offset <> 0 Then %>
<a href="<%=MM_movePrev%>">Previous</a>
<% End If ' end MM_offset <> 0 %>
</font></td>
<td width="23%"> <font size="2">
<% If Not MM_atTotal Then %>
<a href="<%=MM_moveNext%>">Next</a>
<% End If ' end Not MM_atTotal %>
</font></td>
<td width="23%"> <font size="2">
<% If Not MM_atTotal Then %>
<a href="<%=MM_moveLast%>">Last</a>
<% End If ' end Not MM_atTotal %>
</font></td>
</tr>
</table>
<font size="2" face="Verdana, Arial, Helvetica, sans-serif">Showing <strong><%=(rsProds_first)%></strong> to <strong><%=(rsProds_last)%></strong> of <strong><font color="#990000"><%=(rsProds_total)%></font></strong> total items in <strong><%=(rsInfo.Fields.Item("catalogName").Value)%></strong></font><br> <br> </td>
</tr>
<tr>
<td width="12%" bgcolor="#CCCCCC"><font size="2" face="Verdana, Arial, Helvetica, sans-serif">CS
Code</font></td>
<td width="23%" bgcolor="#CCCCCC"><font size="2" face="Verdana, Arial, Helvetica, sans-serif">Name</font></td>
<td width="38%" bgcolor="#CCCCCC"><font size="2" face="Verdana, Arial, Helvetica, sans-serif">Description</font></td>
<td width="15%" align="center" bgcolor="#CCCCCC"><font size="2" face="Verdana, Arial, Helvetica, sans-serif">Stock</font></td>
<td width="12%" align="right" bgcolor="#CCCCCC"><font size="2" face="Verdana, Arial, Helvetica, sans-serif">Add
</font></td>
</tr>
<tr>
<td colspan="6"> </td>
</tr>
<%
While ((Repeat1__numRows <> 0) AND (NOT rsProds.EOF))
%>
<tr>
<td><font size="2" face="Verdana, Arial, Helvetica, sans-serif"><a href="javascript:void(0)" onClick="GP_AdvOpenWindow('detail.asp?productID=<%=(rsProds.Fields.Item("productID").Value)%>','Detail','fullscreen=no,toolbar=no,location=no,status=no,menubar=no,scrollbars=no,resizable=no',650,350,'center','ignoreLink','',0,'');return document.MM_returnValue"><%=(rsProds.Fields.Item("productcode").Value)%></a></font></td>
<td><font size="2" face="Verdana, Arial, Helvetica, sans-serif"><%=(rsProds.Fields.Item("productName").Value)%></font></td>
<td><font size="2" face="Verdana, Arial, Helvetica, sans-serif"><%=(rsProds.Fields.Item("productDesc").Value)%></font></td>
<td width="15%" align="center"><font size="2" face="Verdana, Arial, Helvetica, sans-serif"><%=(rsProds.Fields.Item("numinstock").Value)%></font></td>
<td width="12%" align="right"><font color="#990000" size="1" face="Verdana, Arial, Helvetica, sans-serif">Qty:</font>
<input name="<%=(rsProds.Fields.Item("productCode").Value)%>" type=text value="" size=2>
<input type="hidden" name="<%=(rsProds.Fields.Item("productCode").Value)%>_price" value="<%=(rsProds.Fields.Item("productWt").Value)%>">
<input type="hidden" name="<%=(rsProds.Fields.Item("productCode").Value)%>_desc" value="<%=(rsProds.Fields.Item("productName").Value)%>-<%=(rsProds.Fields.Item("productDesc").Value)%>"></td>
</tr>
<tr>
<td colspan="6"><hr size="1" noshade></td>
</tr>
<%
Repeat1__index=Repeat1__index+1
Repeat1__numRows=Repeat1__numRows-1
rsProds.MoveNext()
Wend
%>
<tr>
<td colspan="6" align="right"><input type="button" onclick="AddItems()" value="Add 2 PO">
<input name="Reset" type="reset" value="Reset"></td>
</tr>
</table>
<br>
<font size="2" face="Verdana, Arial, Helvetica, sans-serif">Showing <strong><%=(rsProds_first)%></strong> to <strong><%=(rsProds_last)%></strong> of <strong><font color="#990000"><%=(rsProds_total)%></font></strong> </font><br>
<table border="0" width="37%">
<tr>
<td width="23%"> <font size="2">
<% If MM_offset <> 0 Then %>
<a href="<%=MM_moveFirst%>">First</a>
<% End If ' end MM_offset <> 0 %>
</font></td>
<td width="31%"> <font size="2">
<% If MM_offset <> 0 Then %>
<a href="<%=MM_movePrev%>">Previous</a>
<% End If ' end MM_offset <> 0 %>
</font></td>
<td width="23%"> <font size="2">
<% If Not MM_atTotal Then %>
<a href="<%=MM_moveNext%>">Next</a>
<% End If ' end Not MM_atTotal %>
</font></td>
<td width="23%"> <font size="2">
<% If Not MM_atTotal Then %>
<a href="<%=MM_moveLast%>">Last</a>
<% End If ' end Not MM_atTotal %>
</font></td>
</tr>
</table>
<% End If ' end Not rsProds.EOF Or NOT rsProds.BOF %>
</form>
<p></p>
<% If rsProds.EOF And rsProds.BOF Then %>
<p><font size="2" face="Verdana, Arial, Helvetica, sans-serif">No Products Found...</font></p>
<% End If ' end rsProds.EOF And rsProds.BOF %>
</body>
</html>
<%
rsCats.Close()
Set rsCats = Nothing
%>
<%
rsProds.Close()
Set rsProds = Nothing
%>
<%
rsInfo.Close()
Set rsInfo = Nothing
%>
it is what you want, i understand the code but it is well comented so im not going to comment. it should let you solve this really quick. again you will need that where in (mylist) in your sql statement or you cna do or col = 1 or col = 2
thanks for that page koncept but that is for a static example although it does shed some light on the problem. that code only displays what you have chosen(kind of what i need) but my problem is how do i take that list and pull out information from a db for display?
In my example I have a list of categories and if i choose 3 categories in that select box, how do i get all the products that belong to those 3 (selected) categories ?
<%@ Language=VBScript %>
<% pageTitle = "Search Action" %>
<!--#include file="adovbs.inc"-->
<!--#include file="db.asp"-->
<%
cats = Request("strCats")
cats = Replace( cats, ", ", "','" )
set Conn = Server.CreateObject("ADODB.Connection")
Conn.Open ConString
sqlText = "SELECT * FROM products WHERE catalodID IN ('" & cats & "')"
%>
<link href="total.css" rel="stylesheet" type="text/css">
</head>
<body>
<p class="total">Your search results:</p>
<table width="70%" border="0" cellspacing="3" cellpadding="3">
<tr bgcolor="#CCCCCC">
<td width="15%" class="total">Product Code</td>
<td width="35%" class="total">Product Name</td>
<td width="35%" class="total">Product Packaging</td>
<td width="15%" class="total">Av Inventory</td>
</tr>
</table>
<%
set rsProd = Conn.Execute(sqlText)
If rsProd.BOF And rsProd.EOF Then
Response.Write "<font face='Verdana' size='1'><strong>"
Response.Write "No items found, please narrow your <a href='javascript:history.back()'>search.</a></b>"
end if
while not rsProd.EOF
%>
<table width="70%" border="0" cellpadding="3" cellspacing="3">
<tr>
<td width="15%" class="total"><a href="product.asp?intProdID=<% Response.Write rsProd("productID") %>"><%= rsProd("productCode") %></a></td>
<td width="35%" class="total"><%= rsProd("productDesc") %></td>
<td width="35%" class="total"><%= rsProd("productPack") %></td>
<td width="15%" class="total"><%= rsProd("NumInStock") %></td>
</tr>
</table>
<%
rsProd.MoveNext
wend
rsProd.Close
set rsProd = Nothing
Conn.Close
set Conn = Nothing
%>
</body>
</html>
And here is the error I get when doing the search:
Code:
Technical Information (for support personnel)
Error Type:
Microsoft JET Database Engine (0x80040E10)
No value given for one or more required parameters.
/shop/searchAction.asp, line 31
Browser Type:
Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; .NET CLR 2.0.50215)
Page:
POST 28 bytes to /shop/searchAction.asp
POST Data:
strCat=7&strCat=10&strCat=12