Hi there, I've been coding in Delphi for a couple of years and
as what I am trying to do here would take me 5 mins in Delphi, so
hopefully for someone who knows this is an easy question.
I want two listboxes on a page. The first listbox should contain a list of areas
populated by a query to a DB. The second listbox initialy contains nothing,
but is populated with a list of towns that belong to a particular area(2nd query).
This should be a second query to the DB using the area selected as part of the criteria.
This is the sort of stuff I have been playing with:
? -indicates where I dunno what is happening
The first bit : populating the 1st list box works.
<FORM Action = "Messing.asp" Name = "ListBoxes" Method="POST" TARGET = "MainFrame">
set ConnectionObject = Server.CreateObject("ADODB.Connection")
set RecordSet = Server.CreateObject("ADODB.RecordSet")
RecordSet.ActiveConnection = ConnectionObject
RecordSet.Source = "Select area,areacode from areas"
? set RecordSet2 = Server.CreateObject("ADODB.RecordSet")
? RecordSet2.ActiveConnection = ConnectionObject
? RecordSet2.Source = "Select town from towns where areacode =" &AreaCode
? Ideally would want to run a second query here but do not know
? how exactly..
Select a province:
<SELECT Name = "ProvinceListBox" onchange = ExecuteTownQuery(RecordSet(1) ????)>
<OPTION value = "<%=Recordset(1)%>"> <% Response.write(RecordSet(0)) %>
loop while RecordSet.Eof = 0
Select a Town:
<SELECT Name = "TownsListBox">