Código Javascript
:
Ver original<script type="text/javascript" src="js/jquery-1.4.2.min.js"></script>
<script language="JavaScript" type="text/JavaScript">
$(document).ready(function(){
$("#select1").change(function(event){
var id = $("#select1").find(':selected').val();
$("#carga_select").load('genera-select.php',"id="+id);
});
}); </script>
Código PHP:
Ver original<script type="text/javascript" src="js/jquery-1.4.2.min.js"></script>
<table>
<form action="reservacion.php" method="post">
<fieldset>
<legend>Seleccionar Plan:</legend>
<label for="input-one" class="float"><strong>Posada:</strong>
</label><br />
<?php
$consulta='select * from posadas';
echo "<select class='inp-text' name='select1' id='select1'>";
echo "
<option value='".$fila['id_posada']."'>".$fila['nombre_posada']."
</option>";
}
echo "</select>";?>
<br />
<label for="input-two" class="float"><strong>Plan:</strong></label>
<br />
<div id="carga_select">
<select class="inp-text" name="select2" id="select2">
<option value="0">Seleccionar... </option>
</select>
</div>
</fieldset>
Código PHP:
Ver originalecho "<select id='select2' name='select2'/>";
$consulta = "SELECT * from planes WHERE id_posada = ".$_GET['id'];
echo '<option value="'.$fila['id'].'">'.$fila['nombre_plan'].'</option>';
};
echo "</select>";