Ver Mensaje Individual
  #6 (permalink)  
Antiguo 03/10/2009, 12:31
douglasroos
 
Fecha de Ingreso: agosto-2009
Mensajes: 59
Antigüedad: 14 años, 8 meses
Puntos: 0
Respuesta: Problema con Select Dependientes

Muchas gracias hermano de todas formas ya lo habia resuelto con esto


Código PHP:
      <script>


var vacia = "";

function categorias(){
   document.miForm.action = "selec2.php";
   document.miForm.selec1.value = vacia;
   document.miForm.submit()

function categorias2(){
   document.miForm.action = "selec3.php";
   document.miForm.submit()

</script>           
                 
                  <?php
  
$selec1 
$_POST['selec1'];
$selec2 $_POST['selec2'];

 
?>
<form name="miForm" id="miForm" method="post">
<table width="0" border="0" cellspacing="0">
  <tr>
    <td>Categorias:<?

include ("conex.php");
$link=Conectarse();
$sSQL="Select * From categorias Order By seleccion";
$result=mysql_query($sSQL);

echo 
'<select name="selec1" id="selec1" onchange="categorias()">';

//Generamos el menu desplegable
while ($row=mysql_fetch_array($result))
{if (
$row['seleccion']==$selec1) {
        echo 
"<option selected>".$selec1."</option>";
    } else {
        echo 
"<option>".$row['seleccion']."</option>";}
}
?>
</select></td>
    <td><?
$sSQL
="Select * From categorias2 where relacion='$selec1' Order By seleccion";
$result=mysql_query($sSQL);

echo 
'<select name="selec2" id="selec2" onchange="categorias2()">';

//Generamos el menu desplegable
while ($row=mysql_fetch_array($result))
{echo 
'<option>'.$row["seleccion"];}

?>
</select></td>
  </tr>
</table>
</form>