Código :
<td class='td1'></td> <td width="98" class='td1' ></td> <td width="129" height="31"><label class="formato">Forma de pago</label></td> <td width="181" class='td1'><select name="empresa" id="empresa" onChange="componer_Centros(this.value)"> <option value="">--Seleccione--</option> <?php if(mysql_num_rows($rs)>0) { while($row = mysql_fetch_assoc($rs)) { ?> <option value="<?=$row["id_form_pago"]?>"><?=$row["descripcion"]?></option> <?php } } ?> </select></td></tr> <td width="138" height="31"><label class="formato">Codigo de pago</label></td> <td width="178" class='td1'><select name="depto" id="depto" onchange='habilitar(this.value);'> <option value="">--Selecione--</option> </select></td> </tr> <!-------------------------CARGAR SEGUNDO COMBO-----------------------> <script> function componer_Centros(cod_area) { <!---------------------- pasar a input name=form----------------------> var seleccion=document.getElementById('empresa'); document.getElementById('form').value=seleccion.options[seleccion.selectedIndex].text; <!--------------------------SEGUNDO COMBO-----------------------------> document.miformulario.depto.length=0; document.miformulario.depto.options[0] = new Option("-- Seleccione --","","defaultSelected",""); var indice=1; <?php $sql_depto = "SELECT * from forma_pago"; $rs_depto = mysql_query($sql_depto, $con); if(mysql_num_rows($rs_depto)>0) { while($row_depto = mysql_fetch_assoc($rs_depto)) { ?> if(cod_area=='<?=$row_depto["id_form_pago"]?>') { document.miformulario.depto.options[indice] = new Option("<?=$row_depto["id_form_pago"]?>","<?=$row_depto["id_form_pago"]?>"); indice++; } <?php } } mysql_close($con); ?> } </script>