php - Real estate site, trying to only output properties based on type -
so inherited old site developer, , i'm not programmer i'm having trouble. i've put code fiddle: https://jsfiddle.net/s6coraf5/
basically there different categories of real estate properties , when click on different pages it's supposed filter them , display ones specific whatever page you're on. problem no matter page you're on, it's displaying everything. i've narrowed down specific code can't figure out why isn't applying right.
in php there's:
$select_title = "unknown"; if ($select_type == "all") { $select_title = "all listings"; } if ($select_type == "office") { $select_title = "office"; } if ($select_type == "industrial") { $select_title = "industrial"; } if ($select_type == "retail") { $select_title = "retail"; } if ($select_type == "shoppingcenter") { $select_title = "shopping center"; } if ($select_type == "land") { $select_title = "land"; } if ($select_type == "agricultural") { $select_title = "ranch / farm"; } if ($select_type == "investment") { $select_title = "investment"; } if ($select_type == "lodging") { $select_title = "lodging"; } if ($select_type == "sportsentertainment") { $select_title = "sports / entertainment"; }
in html there various places $select_type's supposed applied:
a href="properties.php?select_type=<?php echo $select_type;?>&select_city=<?php echo $select_city;?>&priceform=<?= $lowprice;?>,<?= $highprice; ?>&sqft=<?= $lowsize;?>,<?= $highsize; ?>&sort_type=city, asking_price desc"><font size=4><b>location,</b></a>
it's applying "all" 1 though on every page. again, fiddle has full php , html more helpful. realize it's ugly , bad maybe can see obvious can't.
thanks in advance can provide.
based on php code in fiddle (which shouldn't there since fiddle javascript), seems problem never use select_type
given in url.
take @ line. first time $select_type
used.
if (!isset($select_type)) $select_type = "all";
thus, $select_type
all
. instead should either change to:
if (!isset($select_type)) $select_type = $_get['select_type'];
or add line before it:
$select_type = $_get['select_type'];
Comments
Post a Comment