Hi, I am having trouble with this dropdown. With it I am passing an id to the next page but displaying a description in the dropdown. Trouble is it displays a description for every postid so I am getting multiple duplicate descriptions in the dropdown. like
drawing
drawing
drawing
ceramics ceramics.
I can see the problem as I am passing a unique postid its populating the dropdown with all the descriptions associated with my postids.
I need it to only populate the list with a description once for each postid. I have looked at group by etc but cannot see how it could be done if at all.
Any help would be great.
Thanks
richard
drawing
drawing
drawing
ceramics ceramics.
I can see the problem as I am passing a unique postid its populating the dropdown with all the descriptions associated with my postids.
I need it to only populate the list with a description once for each postid. I have looked at group by etc but cannot see how it could be done if at all.
Any help would be great.
Thanks
richard
Code:
<select onChange="window.location='httpp://www.xx.com/directory.asp?postcardid=' + this.options[this.selectedIndex].value">
<OPTION VALUE = 'Genres'> genres</Option>
<OPTION>-----------------------------------------------------</Option>
<%
set conn=server.CreateObject ("adodb.connection")
connect = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" &_
Server.MapPath("xxx") & ";Persist Security Info=False"
conn.Open connect
Set oRs=Server.CreateObject("adodb.recordset")
strSQL = "SELECT DISTINCT Description,postid FROM tblGreetingPostCards Where CategoryID <> " & 60 & " and CategoryID<>" & 61 & " ORDER BY postid"
oRs.Open strSQL, conn
Do while not oRs.EOF
if Request.Form("GreetingPostCards") = oRs("postid") then 'if this is the selected one then display as selected
Response.Write "<OPTION VALUE = '" & oRS ("Description") & "' SELECTED>"
Response.Write oRs("postid") & "</Option>"
oRs.MoveNext
else
Response.Write "<OPTION VALUE = '" & oRs ("postid") & "'> "
Response.Write oRs("Description") & ",</Option>"
oRs.MoveNext
end if
loop
%>
</SELECT>
</div>
</form>
Comment