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 gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

ListBox

Status
Not open for further replies.

Guest_imported

New member
Jan 1, 1970
0
HELP.....

I am trying to fill a single listbox, but when i run the code it makes a seperate listbox for every entry in the database. This is the code that is acting up:<%

Dim Conn
Dim VTTR
Dim Lmn
Set Vttr = Request.QueryString (&quot;vtr&quot;)
sqltext = &quot;Select * from Classifacation ;&quot;
set conn = Server.CreateObject (&quot;adodb.recordset&quot;)
conn.open sqltext, &quot;Dsn=S215&quot;
%>

<%
do until Conn.EOF
%>

<Form id=form1 name=form1>
<Form Action=&quot;127.0.0.1&quot; id=form2 name=form2>
<SELECT id=select1 name=select1>
<OPTION><%=conn(&quot;business type&quot;)%></OPTION>
</SELECT>
</Form>


<%
Conn.MoveNext
loop
%>
Any ideas would be appreciated
 
The problem is you are looping your select tag, which you should not do...

And you have two form declarations, and forms are the only thing (that I know of) that can't be nested inside one another in HTML.

You should also give each of your options a value. Try this out...

...
Code:
%>
<Form Action=&quot;127.0.0.1&quot; id=form2 name=form2 method=post>
<SELECT id=select1 name=select1>
<%
do until Conn.EOF
%>
<OPTION value=<%=conn(&quot;business type&quot;)%><%=conn(&quot;business type&quot;)%></OPTION>
<%
Conn.MoveNext
loop
%>
</SELECT>
</Form>
I added a method of 'post' to your form, too. You should change that if you would rather it be 'get'

hope it helps! :)
Paul Prewett
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top