Guest_imported
New member
- Jan 1, 1970
- 0
Please help, I am getting the first combo box to work great, but I have to pass the selection from the first box to a second box, and the select from the second to a final 3rd box. I am having a hard time following the code, I am pretty new to asp, and my books are horrible.
here is the code I have that works:
-------------------------------------------------------
<%@ Language=VBScript %>
<%Option explicit
Dim oRs, conn, connect, strSQL
set conn=server.CreateObject ("adodb.connection"![Wink ;) ;)](data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7)
connect = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & Server.MapPath("agents.mdb"
& ";Persist Security Info=False"
conn.Open connect
%>
<html>
<head>
<title>combo box</title>
<script language="javascript">
<!--
function dept_onchange(frmSelect) {
frmSelect.submit();
}
//-->
</script>
</head>
<body>
The following was selected : <%=Request.Form ("agents"
%>
<form name="frmSelect" method="Post" action="select.asp">
<SELECT name=agents LANGUAGE=javascript onchange="return dept_onchange(frmSelect)">
<%
Set oRs=Server.CreateObject("adodb.recordset"![Wink ;) ;)](data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7)
strSQL = "SELECT DISTINCT Country FROM agents ORDER BY Country"
oRs.Open strSQL, conn
Do while not oRs.EOF
if Request.Form("agents"
= oRs("Country"
then 'if this is the selected one then display as selected
Response.Write "<OPTION VALUE = '" & oRS ("Country"
& "' SELECTED>"
Response.Write oRs("Country"
& "</Option>"
oRs.MoveNext
else
Response.Write "<OPTION VALUE = '" & oRs ("Country"
& "'>"
Response.Write oRs("Country"
& "</Option>"
oRs.MoveNext
end if
loop
%>
</SELECT>
</form>
</body>
</html>
----------------------------------------------------------
This displays correctly what was selected when it runs. I really need it to go back to my access table and select agents.pagent & agents.sagent WHERE (selected country) = agents.country and populate that combo box with just the Primary & secondary agent (if there is 2) for that country.
any help is always really appreciated.
thank in advance,
-Mike
here is the code I have that works:
-------------------------------------------------------
<%@ Language=VBScript %>
<%Option explicit
Dim oRs, conn, connect, strSQL
set conn=server.CreateObject ("adodb.connection"
connect = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & Server.MapPath("agents.mdb"
conn.Open connect
%>
<html>
<head>
<title>combo box</title>
<script language="javascript">
<!--
function dept_onchange(frmSelect) {
frmSelect.submit();
}
//-->
</script>
</head>
<body>
The following was selected : <%=Request.Form ("agents"
<form name="frmSelect" method="Post" action="select.asp">
<SELECT name=agents LANGUAGE=javascript onchange="return dept_onchange(frmSelect)">
<%
Set oRs=Server.CreateObject("adodb.recordset"
strSQL = "SELECT DISTINCT Country FROM agents ORDER BY Country"
oRs.Open strSQL, conn
Do while not oRs.EOF
if Request.Form("agents"
Response.Write "<OPTION VALUE = '" & oRS ("Country"
Response.Write oRs("Country"
oRs.MoveNext
else
Response.Write "<OPTION VALUE = '" & oRs ("Country"
Response.Write oRs("Country"
oRs.MoveNext
end if
loop
%>
</SELECT>
</form>
</body>
</html>
----------------------------------------------------------
This displays correctly what was selected when it runs. I really need it to go back to my access table and select agents.pagent & agents.sagent WHERE (selected country) = agents.country and populate that combo box with just the Primary & secondary agent (if there is 2) for that country.
any help is always really appreciated.
thank in advance,
-Mike