Holas,
Capaz te sirva esto, lo modifique un poquito:
Código PHP:
Ver original<?php
include ("conexion.php");
?>
<form id="form1" name="form1" method="post">
<div id=dependiente>
<!--Combo principal-->
<select name="regimen" onChange="redirect(this.options.selectedIndex)" style='width:160'>
<option value=0>Regimen</option>
<?
$res = mysql_query("SELECT id_regimen, regimen FROM regimenes ORDER BY regimen"); echo "<option value='".$rw['id_regimen']."' ";
if(isset($_POST['regimen']) && !empty($_POST['regimen']) && ($_POST['regimen']== $rw['id_regimen']) ) echo 'selected';
echo ">";
echo $rw['regimen'];
echo "</option>";
?>
</select>
<!--Combo dinámico-->
<select name="afiliadora" style='width:200px'>
<option value=0>Afiliadoras</option>
<?
if(isset($_POST['id_regimen']) && !empty($_POST['id_regimen'])) { $res = mysql_query("SELECT id_afiliadora, id_regimen, afiliadora FROM afiliadoras WHERE id_regimen='".$_POST['id_regimen']."' ORDER BY afiliadora"); echo "<option value='".$rw['id_afiliadora']."' >";
echo $rw['afiliadora'];
echo "</option>";
}
?>
</select>
</div>
</form>
Saludos
Gildus