Código PHP:
<html>
<head>
<title>Combos combinados</title>
<script language = "JavaScript">
<%CONSULTA PARA OBTENER LOS DATOS
Set Conn = Server.CreateObject("ADODB.Connection")
Conn.Open("DRIVER={Microsoft Access Driver (*.mdb)}; DBQ=" & Server.MapPath("../Data/hard.mdb"))
productos_Sql = "Select distinct familia, codigo, denominacion from articulos "
set rs = CreateObject("ADODB.Recordset")
rs.Open productos_Sql, Conn
x=0
%>
// FUNCION DE COMBO BOX COMBINADO
function sublist(inform, selecteditem)
{
inform.subcatagory.length = 0
<%
count= 0
y=0
do while not rs.eof
%>
x = <%= trim(y) %>;
subcat = new Array();
subcatagorys = "<%=(rs("codigo"))&" "&(rs("denominacion")) %>";
subcatagoryof = "<%=(rs("familia"))%>";
subcatagoryid = "<%=(rs("codigo"))%>";
subcat[x,0] = subcatagorys;
subcat[x,1] = subcatagoryof;
subcat[x,2] = subcatagoryid;
if (subcat[x,1] == selecteditem) {
var option<%= trim(count) %> = new Option(subcat[x,0], subcat[x,2]);
inform.subcatagory.options[inform.subcatagory.length]=option<%= trim(count)%>;
}
<%
count = count + 1
y = y + 1
rs.movenext
loop
rs.close
%>
}
</script>
<base target="principal">
</head>
<body bgcolor="#CDB1B7">
<h2 align="center"><b><i><font color="#AE1732"><u>El PCcillo Feliz</u></font></i></b></h2>
<form name="prueba" method="POST" action="verarticulo.asp">
<div align="center">
<center>
<table border="0" width="80%">
<tr>
<td width="77%">
<select size="1" id="familia" name="familia" onChange = "javascript:sublist(this.form, familia.value);">
<option selected>Selecciona una familia</option>
<%familias_Sql = "Select distinct id,familia from familias"
rs.Open familias_Sql, Conn
do while not rs.eof
%>
<option value="<%=rs("id")%>"><%=rs("familia")%></option>
<%rs.movenext
loop
set rs=nothing
conn.close
set conn=nothing%>
</select> <SELECT id="subcatagory" name="subcatagory" size="1">
<Option selected value="none"></option>
</SELECT></td>
<td width="9%">
<p align="left">
<input border="0" src="images/submit.gif" name="I4" type="image">
</p>
</td>
</tr>
</table>
</center>
</div>
<center>
</form>
</center>
</body>
</html>