Ver Mensaje Individual
  #4 (permalink)  
Antiguo 03/09/2003, 09:04
Avatar de mveraa
mveraa
 
Fecha de Ingreso: diciembre-2002
Ubicación: santiago-chilito
Mensajes: 1.931
Antigüedad: 21 años, 4 meses
Puntos: 2
hola te mando este codigo eso si tienes que revizarlo porque borre algunas cosas , pone en el select 1 las marcas sacadas dela base de datos y carga el select 2 dependiendo del valor del select 1.

saludos

<?php

include ('base.php');

$consulta="SELECT DISTINCT MARCA from autos order by TIPO" ;
$res=mysql_query($consulta) or die ("consulta fallo2");
$num=mysql_num_rows($res);

?>
<em><strong><font size="5">SELECCIONE VEHICULO</font></strong></em>
<p><font size="2"><h3>MARCAS:</h3></font></p>
<form name="form1" method="post" action="">

<select name="sfile0" style="font-family:arial; fonf-weight:bold; font-size:15pt; width:190px; height:50px;">
_<option>SELECCION</option>

<?php
For ($i=0;$i<$num;$i++)
{
$a=mysql_result($res,$i,0);


echo "<option value=\"".$a."\">".$a;


}

ECHO"</td><BR>";
ECHO "<BR>";
echo "<td width=\"75%\"><input type=submit name=boton2 value=BUSCAR>";
ECHO "</FORM></td><BR>";

mysql_close();

?>
</select>

</p>

</p>
</form>


<?php




include ('base.php');


$consulta="SELECT DISTINCT modelo from autos where marca='".$sfile0."'" ;

$res=mysql_query($consulta) or die ("consulta fallo2");
$num=mysql_num_rows($res);


?>

<form name="form2" method="post" target="mainFrame" action=tabla.php>



<input name=sfile0 style="visibility:hidden" value="<?php echo $sfile0 ?>" >

<p><font size="2"><?php echo "<h3>$num" ;echo " ";?>MODELO(S) :<?php ECHO $sfile0;echo "</h3>"; ?></font></p>
<select name="sfile1" style="font-family:arial; fonf-weight:bold; font-size:15pt; width:200px; height:90px;">



<?php

For ($i=0;$i<$num;$i++)
{
$a=mysql_result($res,$i,0);


echo "<option value=\"".$a."\">".$a;
}

ECHO"</td>";

echo "<td width=\"75%\"><input type=submit name=boton2 value=BUSCAR>";
ECHO "</FORM></td><BR>";

mysql_close();
?>
</select>

</p>
<em> <font size="2">

</font> </em> </p>
<p>&nbsp;</p>
</form>
</body>
</html>