Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations biv343 on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

passing combo value as querystring?

Status
Not open for further replies.

ssmenon

Programmer
Sep 6, 2002
8
IN
hello alls
I am sending a programme in that a combobox valueis send by querystring. In the combo all value related to the query is listed but the problem is that only first value is taken even we select the second , third or last value. is there is any problem with the programme?
Plz check the programme and correct it and send to me as the earliest
ssmnon


<%@ Language=VBScript %>
<%
set con = CreateObject(&quot;ADODB.Connection&quot;)
cn = &quot;DRIVER={Microsoft Access Driver (*.mdb)}; DBQ=&quot; & Server.MapPath(&quot;db/testdb.mdb&quot;)
con.open cn
set rs = CreateObject(&quot;ADODB.Recordset&quot;)
set drs = CreateObject(&quot;ADODB.Recordset&quot;)
set rs = con.Execute(&quot;SELECT * FROM LOCATIONtb&quot;)
Set Drs = CON.Execute (&quot;SELECT DISTINCT SDATE FROM testtb&quot;_
&&quot; WHERE SHOWDATE <= DATE()+6 AND SHOWDATE >= DATE()&quot;)
%>
<HTML>
<HEAD>
<META NAME=&quot;GENERATOR&quot; Content=&quot;Microsoft Visual Studio 6.0&quot;>
</HEAD>
<BODY>
<FORM METHOD=&quot;GET&quot; name=testing action=ocd.asp?loccode='<%=rs.Fields(&quot;LOCCODE&quot;).Value %>&loccode='<%=rs.Fields(&quot;sdate&quot;).Value %>'>
<%
if rs.BOF = true then
Response.Write(&quot;NOT SHOWING ANYWHERE&quot;) else
rs.Movefirst
%>
<SELECT NAME=&quot;loccode&quot; SIZE=&quot;1&quot;>
<OPTION VALUE=&quot;&quot;>Select Location</OPTION>
<%Do Until rs.EOF %>
<OPTION value=<%=rs.Fields(&quot;LOCCODE&quot;)%>><%=rs.Fields(&quot;LOCNAME&quot;)%>
</OPTION>
<%rs.MoveNext()
Loop%>
</SELECT>
<%END IF
rs.Close%>
<%
if Drs.BOF = true then
Response.Write(&quot;NOT SHOWING ANYWHERE&quot;)
else
Drs.Movefirst
%>
<SELECT id=select1 name=SDATE>
<OPTION selected value=&quot;&quot;>Select SDATE</OPTION>
<%Do Until drs.EOF %>
<OPTION value=<%=Drs.Fields(&quot;SDATE&quot;)%>><%=drs.Fields(&quot;SDATE&quot;)%>
</OPTION>
<%Drs.Movenext
Loop
%></SELECT>
<%END IF
Drs.Close%>
<TD ALIGN=&quot;CENTER&quot;>
<INPUT TYPE=&quot;submit&quot; NAME=&quot;Submit1&quot; VALUE=&quot;Search&quot;
STYLE=&quot;BACKGROUND-COLOR: gold; BORDER-BOTTOM: medium none&quot;></TD>
</TR> </FORM>
</BODY>
</HTML>
 
Your problem is in the METHOD of your form.
<FORM METHOD=&quot;GET&quot; name=testing action=ocd.asp?loccode='<%=rs.Fields(&quot;LOCCODE&quot;).Value %>&loccode='<%=rs.Fields(&quot;sdate&quot;).Value %>

rs.Fields(&quot;LOCCODE&quot;) => will always bee the first record in the recordset (because you have not begun to step through it)


Your code is a little muttled, so I'll let's try just changing the method to:

<FORM METHOD=&quot;GET&quot; name=&quot;testing&quot; action=&quot;ocd.asp&quot;>


I actually suggest that you change your method of creating your select options after loading your recordset....
<%
Set objConn = Server.CreateObject( &quot;ADODB.Connection&quot; )
Set objCmd = Server.CreateObject( &quot;ADODB.Command&quot; )
Set objRS = Server.CreateObject( &quot;ADODB.Recordset&quot; )
objConn.Open Application(&quot;connectString&quot;)
Set objCmd.ActiveConnection = objConn
objCmd.CommandTimeout = 60

with objCmd
.commandText = &quot;usp_newProjectForm&quot;
.CommandType =adCmdStoredProc
end with
set objRS = objCmd.execute()
optionStr = &quot;<option value=''>Choose One&quot;
do while not objRS.EOF
optionStr = optionStr & &quot;<option value='&quot; & objRS(&quot;valueField&quot;) & &quot;'>&quot; & objRS(&quot;descriptionField&quot;)
objrs.movenext
loop

%>
-----------------------------------------------------------------
[pc] Be nice. It's only doing what you tell it to do.
mikewolf@tst-us.com
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top