I'm programming a map of theatre seats. With this code I try to show selected seats on a previous page, but I can't show all of the seats in a color and in another color the selected ones. It shows all of the seats and only one selected. Then all of the seats again, and another selected. And so on... Any suggestions? Thank you very much and here's the piece of code:
foreach ($AsientosSeleccionadosI as $claveAI=>$valorAI) {
$resultButacas = mysql_query("SELECT U.Id AS IdUbicacion, U.IdModoTeatro, U.Numero, U.Fila, U.IdSector, U.CordX, U.CordY,
P.IdEspectaculo, P.IdFuncion, P.IdSector, P.Precio
FROM TeatroAsiento U, PrecioEspectaculoSector P
WHERE U.IdSector = '$Sector'
AND P.IdSector = '$Sector'
AND P.IdFuncion = '$fn'
AND P.IdEspectaculo = '$id'
");
while($rowButacas=mysql_fetch_array($resultButacas)){
$fila = $rowButacas["Fila"];
$asiento = $rowButacas["Numero"];
$IdUbicacion = $rowButacas["IdUbicacion"];
$precio = $rowButacas["Precio"];
echo '<div id="Casilla"><label for="asiento'.$fila.''.$asiento.'">';
if($IdUbicacion == $valorAI){
echo '<div id="ubicacion" style="background-image: url(../css/images/asientosReservado.png);"><input id="asiento'.$fila.''.$asiento.'" value="'.$IdUbicacion.'" name="asientoI[]" type="hidden"><input id="'.$IdUbicacion.''.$precio.'" value="'.$precio.'" type="hidden" name="precioseleccionI[]">';
}else{
echo '<div id="ubicacion" style="background-image: url(../css/images/asientosDisponible.png);">';
}
echo 'F: '.$fila.'<br>Nro: '.$asiento.'<br>'.$precio.'';
echo '</div></label></div>';
}
}