ASP Forum
heeeellp!!!!!!!damsel in distress!!like major!!
misfit | Posted 6:36pm 10. March 2008 Server Time |

hi, please can someone help me with this?iv got this assignment to do and its in for friday and im stuk on this one bit.
im tryin to create a drop down box that will allow me to select multiple items as opposed to just one item like i have atm. im using sql and asp to do this.
this is the code iv got now


<%@LANGUAGE="VBSCRIPT"%><%

Dim strSQL, objConn, objRs,StrStock

strSQL = "select * from STOCK order by description"
  
Set objConn = Server.CreateObject("ADODB.Connection")
objConn.open "dsn=Oracle;uid=06255996;pwd=040288"
Set objRs=objConn.execute(strSQL)
%>


<HTML>
<HEAD>
<TITLE>ASP Example: check stock</TITLE>
<HEAD>
<BODY>


<style type="text-css">

</style>

<body bgcolor="FFFFCC">

<font color="black" face="Arial">
<h1><p align="center">Stock Check
</p></h1>

<hr width="900" size="50" color="orange">

<br>

<font face="Arial"><font color="#23B2F5"><u><font size=4>
<b</b></font size></u>


<FORM ACTION="stocklist.asp" METHOD="GET" NAME="frmstocksearch">

<P>select an item to check availability<br>

<SELECT NAME="ITEM">
<%
Do While Not (objRs.EOF)
%>
<OPTION VALUE="<%=objRs("ITEMNO")%>"><%=objRs("ITEMNO")%><%=objRs("DESCRIPTION")%></OPTION>


<%
objRs.MoveNext
Loop
objRs.Close
Set objRs=Nothing
objConn.close
Set objConn=Nothing
%>
</SELECT>
<P><INPUT TYPE="Submit" VALUE="See availability of this item"
onClick="this.form.action='stocklist.asp';">

</SELECT>


<P>see all items below
<INPUT TYPE="text" NAME = "Val" SIZE=4 MAXLENGTH=4>



<BR>
<P>
<P><INPUT TYPE="Submit" VALUE="See items"
onClick="this.form.action='stockresults2.asp';">


</FORM>
</BODY>
</HTML>

basically wat im tryin to do is select one or more items which will take me to another page that displays the product details,im just not sure how to do a multiple selection box and what page to put it on. please help!!!!
katy8439 | Posted 7:53am 11. March 2008 Server Time |

In your select box:

<SELECT NAME="ITEM">

Change this to

<SELECT NAME="ITEM" Multiple size="3">

This would then show 3 items with a scroll bar down the side.

Remember that when you submit the form, if you've selected more than one item they will come through to the submission page as one result e.g.

Item1, Item2, Item3

You'll need to split the form values to access the separate selected items.

Good Luck!
misfit | Posted 1:41pm 11. March 2008 Server Time |

hi,thnks 4 replying but im stil stuk:-(
i need to keep my drop down box as it is as im doing a system that can hold hundreds of products so it has to be done dynamically. do u have any suggestions to showing the data another way?
do i split the items on this page or the page this one links to? im kinda new to this so excuse me if i ask anything stupid. my other oage looks like this
<%@LANGUAGE="VBSCRIPT"%><HTML>

<HTML>
<HEAD>
<BODY>

<style type="text-css">

</style>

<body bgcolor="FFFFCC">

<font color="black" face="Arial">
<h1><p align="center">Stock Check
</p></h1>

<hr width="900" size="50" color="orange">

<br>

<font face="Arial"><font color="#23B2F5"><u><font size=4>
<b</b></font size></u>


<HEAD>
<TITLE>ASP stock Page</TITLE>
<HEAD>
<%

Dim strSQL, objConn, objRs, strStock

strStock = Request.QueryString ("ITEM")
strSQL = "select * from stock where itemno = '" & strstock & "'order by itemno, description"


Set objConn = Server.CreateObject("ADODB.Connection")
objConn.Open "dsn=Oracle;uid=06255996;pwd=040288;"
Set objRs = objConn.execute(strSQL)
%>
<BODY>

<%If (objRs.BOF) then%>
<P>Sorry, no information is available for this item
<%Else%>
<P>stock list<BR>
<TABLE border= "1">
<TR>
<TD>itemno</TD>
<TD>description</TD>
<TD>quantity</TD>
<TD>type</TD>
</TR>
<%Do While Not (objRs.EOF)%>
<TR>
<TD><%=objRs("ITEMNO")%></TD>
<TD><%=objRs("DESCRIPTION")%></TD>
<TD><%=objRs("QUANT")%></TD>
<TD><%=objRs("TYPE")%></TD>
</TR>
<%
objRs.MoveNext
Loop
%>
</TABLE>
<%
End If
objRs.Close
Set objRs=Nothing
objConn.Close
Set objConn=Nothing
%>

</BODY>
</HTML>


do u have any idea how i can put validation into my search page?


Reply to Post heeeellp!!!!!!!damsel in distress!!like major!!



Back to Forum Page