Ver Mensaje Individual
  #20 (permalink)  
Antiguo 19/06/2007, 15:51
Avatar de lilith_sr
lilith_sr
 
Fecha de Ingreso: enero-2007
Ubicación: México
Mensajes: 113
Antigüedad: 17 años, 3 meses
Puntos: 2
Re: Llenar combo con datos de una tabla

espero que esto te sirva
Código PHP:
<form  action="pagina.php" method="post">
<select name="materiaid" onChange="submit(this.form)">
    <option value="">-----</option>
<?php 
  
$query
=("Select * from materias");
while(
$reg=mysql_fetch_array($query))
{
?>
  <option  value="<?=$reg['materiaid']?>"><?=$reg['nombre']?></option>
<?php                    
}
?>
 </select>

 <? $query=("Select * from subestacion where idgeografica='$materiaid'");
    
$reg=mysql_fetch_array($query)
    
?>
              <input name="campo" type="text" value="<?=$reg['campo']?>" size="50">