Hi everybody, hope somebody can help me with this that had been turned in a lot of headaches, lol
Ok, I have this page for a costumer, it's a Real Estate site, so what my client wants is to find houses by state, zip code, and some other ones. I already did that, the problem comes next, 'cause when I have all those houses shown, he wants to show them by clicking on a check box which houses are going to be shown. That is done too, the thing is I don't know how to save those options they checked and show them in another page with numbers, each number of the page is a single house with a hyperlink to show on click the other house(in order by price), I already got that but when you clic on 2, or 3 to get to the other house the browser some how forgets which houses you have clicked on.
http://www.inmueblesymas.com.mx/casa_sola.php
this is the hyperlink, type in 53100 in Prefiere Código postal. (i know of the mysql error already, igonore that, check more than one option then click filtrar, notice otros? there are as many number(hyperlinks) as houses you clicked in the previous, now click one of the numbers ( all the numbers now are gone except one, the house you are now lookin at). How can i send a variable that will remember the array? HELP PLEASE!!!
Thank you so much
Problem with array of a filter
Moderator: General Moderators
- Chris Corbyn
- Breakbeat Nuttzer
- Posts: 13098
- Joined: Wed Mar 24, 2004 7:57 am
- Location: Melbourne, Australia
- John Cartwright
- Site Admin
- Posts: 11470
- Joined: Tue Dec 23, 2003 2:10 am
- Location: Toronto
- Contact:
- Chris Corbyn
- Breakbeat Nuttzer
- Posts: 13098
- Joined: Wed Mar 24, 2004 7:57 am
- Location: Melbourne, Australia
Re: Problem with array of a filter
Have you tried sessions?yayo wrote:How can i send a variable that will remember the array? HELP PLEASE!!!
EDIT | Ooops too slow, beaten my JCart
Code: Select all
<?
include ("includes/connect.inc");
?>
<?
global $id_producto;
if(isset($id_producto))
{
for ($i = 0; $i < count($id_producto); $i++)
{
$id_house = $id_producto[$i];
//calling producto from query
$query = mysql_query("SELECT * FROM producto WHERE id_producto = '$id_house'");
$q_query = mysql_fetch_array($query);
//images
//$image_query = mysql_query("SELECT * FROM imagenes WHERE productos.id_producto = imagenes.id_producto");
//$image_q_query = mysql_fetch_array($query);
$j = 0;
$houses[$j] = $q_query;
$j++;
}
if(count($houses) > 0)
{
$max_price = $houses[0]["precio_v"];
//$first_image = $images[0]["nombre"];
$position = 0;
}
for ($i = 0; $i < count($houses); $i++)
{
$price = $houses[$i]["precio_v"];
//$image = $images[$i]["nombre"];
if($price > $max_price)
{
$max_price = $price;
// $first_image = $image;
$position = $i;
}
}
}
/* $query = mysql_query("SELECT * FROM imagenes WHERE id_producto = '$id_image'");
$q_query = mysql_fetch_array($query);
$h = 0;
$images[$h] = $q_query;
$h++;
*/
?>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<title>Inmueblesymas.com.mx</title>
<style type="text/css">
<!--
body,td,th {
font-size: 14px;
color: #333333;
font-family: Arial, Helvetica, sans-serif;
}
.style1 {
font-size: 24px;
color: #FFFFFF;
font-weight: bold;
}
body {
margin-top: 0px;
}
.style5 {
font-size: 20px;
font-weight: bold;
}
.style7 {font-size: 20px}
a:link {
color: #CC3333;
}
a:visited {
color: #CC3333;
}
a:hover {
color: #FF0000;
}
a:active {
color: #CC3333;
}
-->
</style></head>
<body>
<table width="790" height="328" border="0" align="center">
<tr>
<td height="324" align="left" ><table width="100%" height="81" border="0">
<tr>
<td width="67%" align="left" valign="top"><object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,29,0" width="525" height="115">
<param name="movie" value="arriba.swf">
<param name="quality" value="high">
<embed src="arriba.swf" quality="high" pluginspage="http://www.macromedia.com/go/getflashplayer" type="application/x-shockwave-flash" width="525" height="115"></embed>
</object></td>
<? include("bp.php") ?>
</tr>
</table>
<!--**********************************************************************************************************
JIMMY LOOK HERE MAN, THANKS FOR HELPIN
************************************************************************************** *********************-->
<form name="email" method="post" action="email_setup.php">
<center><b>Otros:</b>
<?
for($i=0; $i<count($id_producto); $i++)
{
?>
<a href="foto_grande.php?id_producto[]=<?=$id_producto[$i];?>">
<?
print $i + 1;
?></a><?
print " ";
}
?></center>
<table width="100%" valign="top" border="0">
<tr>
<td height="224" align="left" valign="top"><table width="100%" bordercolor="#CC3333" border="1">
<tr>
<td width="50%" align="center" valign="middle">
<?
// ***************** VICTOR IS EDITING THIS PART TO SHOW THE IMAGE THAT CORRESPOND TO THE PRODUCTO **************
//get name of the image for the product
//get $num_img from db
$q_query_num_img = mysql_query ("SELECT num_img FROM imagenes WHERE id_producto = '$id_house' ORDER BY num_img DESC");
if ($q_num_img = mysql_fetch_array($q_query_num_img) > 0)
{
$q_query_nom_img = mysql_query ("SELECT num_img, extension FROM imagenes WHERE id_producto = '$id_house' ORDER BY num_img ASC");
$q_nom_img = mysql_fetch_array($q_query_nom_img);
$num_img = $q_nom_img ["num_img"];
$extension = $q_nom_img ["extension"];
//get $name of the image
$q_query_producto = mysql_query ("SELECT producto FROM producto WHERE id_producto = '$id_house'");
$q_producto = mysql_fetch_array ($q_query_producto);
$nombre_img = str_replace (" ","_",$q_producto ["producto"]);
//build the name of the image
$image = $id_house."_".$num_img."_".$nombre_img.".".$extension;
?>
<img src="imagenes/<?=$image;?>" width="250" height="193"><br>
<?
}
else
{
print ("El inmueble no cuenta con imagenes actualmente");
}
?>
<br><br><br><br><br></a><center><u><b>FOTOS</b></u></center>
<?
$image_query = mysql_query("SELECT * FROM imagenes WHERE id_producto = '$id_house'");
while($image_q_query = mysql_fetch_array($image_query))
{
?>
<a href="foto_grande.php?id_producto=<?=$id_producto[$i];?>">
<?
print $image_q_query["num_img"];
?></a><?
print " ";
}
?></td>
<td width="50%" align="left" valign="top">
<center><font color="#CC3333"> <b>Contacto</center>
<table width="342" border="1" align="center" bordercolor="#CC3333">
<tr>
<th width="100" scope="col" bgcolor="#CCCCCC" align="right"><font color="gray">Asesor:<br>Clave:<br>Producto:<br>Tel1:<br>Tel2:</font></th>
<th scope="col" align="center"><? print $houses[$position]["asesor"];?><br><? print $houses[$position]["clave"];?><br><? print $houses[$position]["producto"];?><br><? print $houses[$position]["tel1"];?><br><? print $houses[$position]["tel2"];?></th>
</tr>
</table>
<center>Ubicacion</center>
<table width="342" border="1" align="center" bordercolor="#CC3333">
<tr>
<th width="100" scope="col" bgcolor="#CCCCCC" align="right"><font color="gray">Calle:<br>Estado:<br>CD./MDO./DEL:<br>Colonia:</font></th>
<th scope="col" align="center"><?print $houses[$position]["calle"];print " "; print $houses[$position]["num_ext"];?><br><?print $houses[$position]["estado"];?><br><? print $houses[$position]["ciudad"];?><br><? print $houses[$position]["colonia"];?></th>
</tr>
</table>
<center>Caracteristicas:</center>
<table border="1" align="center" bordercolor="#CC3333">
<tr>
<th width="100" align="right" valign="top" bgcolor="#CCCCCC" scope="col">
<font color="gray">
<?if($houses[$position]["terreno"] != "0")
{
print "Terreno";
print " <br>";
}?>
<?if($houses[$position]["niveles"] != "0")
{
print "Niveles:";
print " <br>";
}?>
<?if($houses[$position]["jardin"] != "0")
{
print "Jardin:";
print " <br>";
}?>
<?if($houses[$position]["recamaras"] != "0")
{
print "Recamaras:";
print " <br>";
}?>
<?if($houses[$position]["estudio"] != "0")
{
print "Estudio:";
print " <br>";
}?>
<?if($houses[$position]["sala"] != "0")
{
print "Sala:";
print " <br>";
}?>
<?if($houses[$position]["construccion"] != "0")
{
print "Construccion:";
print " <br>";
}?>
<?if($houses[$position]["estacionamiento"] != "0")
{
print "Estacion.:";
print " <br>";
}?>
<?if($houses[$position]["terraza"] != "0")
{
print "Terraza:";
print " <br>";
}?>
<?if($houses[$position]["vestidor"] != "0")
{
print "Vestidores:";
print " <br>";
}
if($houses[$position]["sala_tv"] != "0")
{
print "Sala TV:";
print " <br>";
}
if($houses[$position]["comedor"] != "0")
{
print "Comedor:";
print " <br>";
}
if($houses[$position]["acabado"] != "0")
{
print "Acabados:";
print " <br>";
}
if($houses[$position]["bano"] != "0")
{
print "Banos:";
print " <br>";
}
if($houses[$position]["bano_medio"] != "0")
{
print "1/2 Banos:";
print " <br>";
}
if($houses[$position]["cocina"] != "0")
{
print "Cocina:";
print " <br>";
}
if($houses[$position]["antecomedor"] != "0")
{
print "Antecomedor:";
print " <br>";
}
if($houses[$position]["cuarto_serv"] != "0")
{
print "Cuarto Serv:";
}
?>
</font></th>
<td width="74" align="center" valign="top"><b>
<?if($houses[$position]["terreno"] != "0")
{
print $houses[$position]["terreno"];
print " <br>";
}
if($houses[$position]["niveles"] != "0")
{
print $houses[$position]["niveles"];
print " <br>";
}
if($houses[$position]["jardin"] != "0")
{
print $houses[$position]["jardin"];
print " <br>";
}
if($houses[$position]["recamaras"] != "0")
{
print $houses[$position]["recamaras"];
print " <br>";
}
if($houses[$position]["estudio"] != "0")
{
print $houses[$position]["estudio"];
print " <br>";
}
if($houses[$position]["sala"] != "0")
{
print $houses[$position]["sala"];
print " <br>";
}
if($houses[$position]["construccion"] != "0")
{
print $houses[$position]["construccion"];
print " <br>";
}
if($houses[$position]["estacionamiento"] != "0")
{
print $houses[$position]["estacionamiento"];
print " <br>";
}
if($houses[$position]["terraza"] != "0")
{
print $houses[$position]["terraza"];
print " <br>";
}?>
<?
if($houses[$position]["vestidor"] != 0)
{
print $houses[$position]["vestidor"];
print " <br>";
}
if($houses[$position]["sala_tv"] != 0)
{
print $houses[$position]["sala_tv"];
print " <br>";
}
if($houses[$position]["comedor"] != 0)
{
print $houses[$position]["comedor"];
print " <br>";
}
if($houses[$position]["acabado"] != 0)
{
print $houses[$position]["acabado"];
print " <br>";
}
if($houses[$position]["bano"] != 0)
{
print $houses[$position]["bano"];
print " <br>";
}
if($houses[$position]["bano_medio"] != 0)
{
print $houses[$position]["bano_medio"];
print " <br>";
}
if($houses[$position]["cocina"] != 0)
{
print $houses[$position]["cocina"];
print " <br>";
}
if($houses[$position]["antecomedor"] != 0)
{
print $houses[$position]["antecomedor"];
print " <br>";
}
if($houses[$position]["cuarto_serv"] != 0)
{
print $houses[$position]["cuarto_serv"];
print " <br>";
}?>
</td>
<!--<th width="100" scope="col" bgcolor="#CCCCCC" align="right">
<font color="gray">
</font>
</th>-->
<!--<td width="40" align="center" valign="top">-->
<!--</td>-->
</tr>
</table>
<center>Precios</center></font></b>
<table width="100" border="1" align="center" bordercolor="#CC3333">
<tr >
<td><center><b>$<?=number_format($q_query ["precio_v"], 2, '.', ',');?></center></td>
</tr>
</table>
<br>
<center><input name="send" type="submit" value="Contactenos" size="20">
<input type="hidden" name="id_house" value="<?=$id_house;?>"></center></a>
</td>
</tr>
</table></td>
</tr>
</table>
<table width="100%" border="0">
<tr>
<td align="center"><a href="casa_sola_1.php?colonia=<?=$q_query["colonia"];?>&zip_code=<?=$q_query["cp"];?>" class="style7">REGRESAR</a></td>
</tr>
</table></td>
</tr>
</table></td>
</tr>
</table>
<table width="790" border="0" align="center">
<tr>
<td align="left" valign="top" bgcolor="#CC3333"><div align="right"><span class="style4"><? include("footer.php") ?></span></div></td>
</tr>
</table>
</form>
</body>
</html>- John Cartwright
- Site Admin
- Posts: 11470
- Joined: Tue Dec 23, 2003 2:10 am
- Location: Toronto
- Contact:
Please use
Code: Select all
tags and try to minimize the code length to neccesary areas only.