este es el codigo de la pagina:
Código HTML:
<?php require_once('Connections/conexion.php'); ?>
<?php
if (!isset($_SESSION)) {
session_start();
}
if (!function_exists("GetSQLValueString")) {
function GetSQLValueString($theValue, $theType, $theDefinedValue = "", $theNotDefinedValue = "")
{
if (PHP_VERSION < 6) {
$theValue = get_magic_quotes_gpc() ? stripslashes($theValue) : $theValue;
}
$theValue = function_exists("mysql_real_escape_string") ? mysql_real_escape_string($theValue) : mysql_escape_string($theValue);
switch ($theType) {
case "text":
$theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
break;
case "long":
case "int":
$theValue = ($theValue != "") ? intval($theValue) : "NULL";
break;
case "double":
$theValue = ($theValue != "") ? doubleval($theValue) : "NULL";
break;
case "date":
$theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
break;
case "defined":
$theValue = ($theValue != "") ? $theDefinedValue : $theNotDefinedValue;
break;
}
return $theValue;
}
}
mysql_select_db($database_conexion, $conexion);
$query_rsMarca = "SELECT distinct categoria.marca FROM categoria ORDER BY marca ASC";
$rsMarca = mysql_query($query_rsMarca, $conexion) or die(mysql_error());
$row_rsMarca = mysql_fetch_assoc($rsMarca);
$totalRows_rsMarca = mysql_num_rows($rsMarca);
$lst_marca_rsColeccion = "-1";
if (isset($_GET['lst_marca'])) {
$lst_marca_rsColeccion = $_GET['lst_marca'];
}
mysql_select_db($database_conexion, $conexion);
$query_rsColeccion = sprintf("SELECT distinct categoria.coleccion FROM categoria WHERE categoria.marca = %s ORDER BY coleccion ASC", GetSQLValueString($lst_marca_rsColeccion, "text"));
$rsColeccion = mysql_query($query_rsColeccion, $conexion) or die(mysql_error());
$row_rsColeccion = mysql_fetch_assoc($rsColeccion);
$totalRows_rsColeccion = mysql_num_rows($rsColeccion);
?>
<script language="JavaScript" type="text/javascript">
function AlmacenarVariable()
{
var lst_marca=document.forms.avanzada;
lst_marca.action="busqueda_avanzada.php";
lst_marca.submit();
}
</script>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>index.html</title>
<style type="text/css">
body {
margin-left: 0px;
margin-top: 0px;
margin-right: 0px;
margin-bottom: 0px;
text-align: center;
}
</style>
<link href="css/estilos.css" rel="stylesheet" type="text/css" />
</head>
<body>
<table width="1000" height="845" border="0" align="center" cellpadding="0" cellspacing="0">
<tr align="center" valign="top">
<td height="125" align="center" valign="top"td><?php include ("menu_cabecera.php");?></td>
</tr>
<tr align="center" valign="top">
<td height="665"><table width="1000" border="0" cellspacing="0" cellpadding="0">
<tr>
<td width="140" height="665" align="center" valign="top"><table width="140" border="0" cellspacing="0" cellpadding="0">
<tr>
<td> </td>
</tr>
<tr>
<td><?php include ("menu_productos.php");?></td>
</tr>
<tr>
<td> </td>
</tr>
<tr>
<td></td>
</tr>
<tr>
<td> </td>
</tr>
<tr>
<td> </td>
</tr>
</table></td>
<td width="720" align="center" valign="top">
<table width="720" border="0" cellspacing="0" cellpadding="0">
<tr><td> </td></tr>
</table>
<table width="680" border="0" cellspacing="2" cellpadding="0">
<tr>
<td height="25" align="center" valign="middle" background="imagenes/barra_gris_brillo_redondeada.png" class="titulos">
Busqueda Avanzada</td>
</tr>
</table>
<table width="676" border="0" cellpadding="0" cellspacing="0" class="borde_gris">
<tr>
<td height="150" align="center" valign="top"><table width="500" border="0" cellpadding="0" cellspacing="0">
<tr>
<td width="613"> </td>
</tr>
<tr>
<td> </td>
</tr>
<tr>
<td height="217" align="left" valign="middle" class="texto_gris">
<form id="avanzada" name="avanzada" method="get" action="busqueda_avanzada_resultado.php">
<table width="500">
<tr>
<td width="80" align="right" valign="middle" class="texto_gris">Marca</td>
<td width="408" align="left" valign="middle" class="texto_gris">
<select name="lst_marca" id="lst_marca" onChange="return AlmacenarVariable(lst_marca.value)">
<?php
do {
?>
<option value="<?php echo $row_rsMarca['marca']; ?>" selected=""><?php echo $row_rsMarca['marca']; ?></option>
<?php
} while ($row_rsMarca = mysql_fetch_assoc($rsMarca));
$rows = mysql_num_rows($rsMarca);
if($rows > 0) {
mysql_data_seek($rsMarca, 0);
$row_rsMarca = mysql_fetch_assoc($rsMarca);
}
?>
</select></td>
</tr>
<tr>
<td align="right" valign="middle" class="texto_gris">Colección</td>
<td align="left" valign="middle" class="texto_gris">
<select name="lst_coleccion" id="lst_coleccion" title="<?php echo $row_rsColeccion['coleccion']; ?>">
<?php
do {
?>
<option value="<?php echo $row_rsColeccion['coleccion']?>"><?php echo $row_rsColeccion['coleccion']?></option>
<?php
}while ($row_rsColeccion = mysql_fetch_assoc($rsColeccion));
$rows = mysql_num_rows($rsColeccion);
if($rows > 0) {
mysql_data_seek($rsColeccion, 0);
$row_rsColeccion = mysql_fetch_assoc($rsColeccion);
}
?>
</select></td>
</tr>
<tr>
<td align="right" valign="middle" class="texto_gris">Precio entre</td>
<td align="left" valign="middle" class="texto_gris">
<select name="lst_precio1" id="lst_precio1">
<option>50</option>
<option selected="selected">100</option>
<option>150</option>
<option>200</option>
<option>250</option>
<option>300</option>
<option>400</option>
<option>500</option>
<option>1000</option>
<option>5000</option>
</select>
y
<label for="lst_precio2"></label>
<select name="lst_precio2" id="lst_precio2">
<option>50</option>
<option>100</option>
<option>150</option>
<option selected="selected">200</option>
<option>250</option>
<option>300</option>
<option>400</option>
<option>500</option>
<option>1000</option>
<option>5000</option>
</select> €</td>
</tr>
</table>
<br />
<input name="button" type="image" id="button" src="imagenes/boton_buscar.png" />
</form></td>
</tr>
</table>
</td>
</tr>
</table>
<td width="140" align="center" valign="top"><table width="140" border="0" cellspacing="0" cellpadding="0">
<tr>
<td> </td>
</tr>
<tr>
<td><?php include ("menu_tienda.php");?></td>
</tr>
<tr>
<td> </td>
</tr>
<tr>
<td> </td>
</tr>
<tr>
<td> </td>
</tr>
</table></td>
</tr>
</table></td>
</tr>
<tr align="center" valign="top">
<td td height="50">
<table width="1000" border="0" cellspacing="0" cellpadding="0">
<tr><td width="1000" height="50"><?php include ("menu_pie.php");?></td></tr>
</table>
</td>
</tr>
</table>
<br />
</body>
</html>
<?php
mysql_free_result($rsMarca);
mysql_free_result($rsColeccion);
?>
espero que veas alguna solucion porque yo no se como seguir.
pd: creo que con ajax no puedo hacerlo, porque implicaria que en la lista 1 me salgan todos los registros de la tabla categorias (saldrian marcas repetidas y no funcionaria bien ya que usa los id de cada campo)