Hola buenas tardes me gustaria saber si me podrian ayudar con unos selects dependientes de una sola tabla mi tabla se llama vehiculo con los campos marca,modelo,año,motor asta ahora lo tengo asi --->
Código HTML:
Ver original<?php error_reporting(E_ERROR); ?>
<?
require('config.php');
require('include/conexion.php');
?>
html { background-image: url(images/glowcolor.png); }
#Layer3 {
background-color: rgba(54, 206, 240, 0.5);
-moz-border-radius: 1em;
-webkit-border-radius: 1em;
border-radius: 1em;
background-position: center;
width:600px;
}
<script language="javascript"> function myChangeHandler() {
this.options[this.selectedIndex].value;
this.form.submit();
}
<form id="1" name="1" method="post" action="2.php">
<?php
$sql = "Select DISTINCT marca from vehiculo order by marca";
$result = mysql_query( $sql);
?>
<font face="calibri" color="#FFFFFF"> MARCA
</font> <select name="marca" id="marca" onchange="myChangeHandler.apply(this)"> <option>------------------SELECCIONA------------------
</option> <?php while ( $row = mysql_fetch_array($result) ) {?>
<?php } ?>
.....en el segundo archivo 2.php
<?php error_reporting(E_ERROR); ?>
<?
require('config.php');
require('include/conexion.php');
?>
html { background-image: url(images/glowcolor.png); }
#Layer3 {
background-color: rgba(54, 206, 240, 0.5);
-moz-border-radius: 1em;
-webkit-border-radius: 1em;
border-radius: 1em;
background-position: center;
width:600px;
}
<script language="javascript"> function myChangeHandler() {
this.options[this.selectedIndex].value;
this.form.submit();
}
<form id="1" name="1" method="post" action="3.php">
<?php
$marca=$_POST['marca'];
?>
<font face="calibri" color="#FFFFFF"> MARCA
</font> <select name="marca" id="marca"> <option>------------------SELECCIONA------------------
</option>
<?php
$modelo=$_POST['marca'];
$sql = "Select DISTINCT vehiculo.modelo from vehiculo where marca='$modelo' order by modelo";
$result = mysql_query( $sql);
?>
<font face="calibri" color="#FFFFFF"> MODELO
</font> <select name="modelo" onchange="myChangeHandler.apply(this)"> <option>------------------SELECCIONA------------------
</option> <?php while ( $row = mysql_fetch_array($result) ) {?>
<?php } ?>
el detalle aki eske si kiero consultar nuevamente tengo k empezar desde marca y lo que k realmente necesito es que pueda ir intercalando la buskeda k me pueda regresar a modelo y se cargue automaticamnte el año y motor o si me regreso al año se cambien los motores etc...y asi sucesivamente de acuerdo al select k requiera... esa forma funciona bien aunque con jquery o ajax se veria mucho mejor o alguien tiene una mejor sugerencia
quiero hacer algo igual a esto solo k esta en aspx y yo estoy con php
http://www.standardbrand.com/online%20catalogs-ecatalog/content.aspx