 |
Account Login
|
 |
 |
Latest Articles
|
 |
 |
IRC Channel
|
 |
 |
Associates
|
 |
 |
Associates
|
 |
|
 |
 |
|
 |
10-20-2009, 11:25 AM
|
#1 (permalink)
|
|
The Wanderer
Join Date: Oct 2009
Posts: 6
Thanks: 1
|
Search, having "any" as an option
Hi folks, ok here's my first question on here...
I'm building a web site for a small property lettings company.
There's a search facility, so people can search for a property to let.
I'd like to include an "any" option in the search list e.g.
Apartment
House
Bungalow
Any
So people can choose "any" if they are not to bothered about that particular option.
When I try to do an "any" search, the page returns no matches. I guess this is because my query is looking for "any" in the fields.
How can I get around this? I've built the site using Dreamweaver, here's my results page..
Really appreciate any help as I am totally stuck!
Rich...:)
<?php require_once('Connections/wilkins.php'); ?>
<?php
if (!function_exists("GetSQLValueString")) {
function GetSQLValueString($theValue, $theType, $theDefinedValue = "", $theNotDefinedValue = "")
{
$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;
}
}
$currentPage = $_SERVER["PHP_SELF"];
$type_lettings = "-1";
if (isset($_REQUEST["type"])) {
$type_lettings = $_REQUEST["type"];
}
$bedrooms_lettings = "-1";
if (isset($_REQUEST["beds"])) {
$bedrooms_lettings = $_REQUEST["beds"];
}
$rentamount_lettings = "-1";
if (isset($_REQUEST["rent"])) {
$rentamount_lettings = $_REQUEST["rent"];
}
mysql_select_db($database_wilkins, $wilkins);
$query_lettings = sprintf("SELECT * FROM lett_property, teaser, instructions WHERE teaser.property_ID = lett_property.lett_ID AND lett_property.property_type = %s AND lett_property.beds = %s AND lett_property.rent < %s AND teaser.property_ID = instructions.property_ID GROUP BY lett_property.lett_ID ORDER BY lett_property.rent ", GetSQLValueString($type_lettings, "text"),GetSQLValueString($bedrooms_lettings, "int"),GetSQLValueString($rentamount_lettings, "int"));
$lettings = mysql_query($query_lettings, $wilkins) or die(mysql_error());
$row_lettings = mysql_fetch_assoc($lettings);
$totalRows_lettings = mysql_num_rows($lettings);
mysql_select_db($database_wilkins, $wilkins);
$query_all_lett = "SELECT * FROM lett_property, teaser, instructions WHERE teaser.property_ID = lett_property.lett_ID AND teaser.property_ID = instructions.property_ID GROUP BY lett_property.lett_ID ORDER BY lett_property.rent ASC";
$all_lett = mysql_query($query_all_lett, $wilkins) or die(mysql_error());
$row_all_lett = mysql_fetch_assoc($all_lett);
$totalRows_all_lett = mysql_num_rows($all_lett);
$queryString_lettings = "";
if (!empty($_SERVER['QUERY_STRING'])) {
$params = explode("&", $_SERVER['QUERY_STRING']);
$newParams = array();
foreach ($params as $param) {
if (stristr($param, "pageNum_lettings") == false &&
stristr($param, "totalRows_lettings") == false) {
array_push($newParams, $param);
}
}
if (count($newParams) != 0) {
$queryString_lettings = "&" . htmlentities(implode("&", $newParams));
}
}
$queryString_lettings = sprintf("&totalRows_lettings=%d%s", $totalRows_lettings, $queryString_lettings);
?><!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">
<!-- Website design and hosting by Greenfrog Computing Ltd -->
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Wilkins Hammond Lettings & Management, Commercial & Land Services</title>
<link href="css/layout.css" rel="stylesheet" type="text/css" />
<script src="Scripts/AC_RunActiveContent.js" type="text/javascript"></script>
</head>
<body>
<!-- Header -->
<div id="header">
<div id="top_nav">
<ul id="navigation">
<li><a href="meet_us.html">meet us</a></li>
<li><a href="find_us.html">find us</a></li>
<li><a href="contact_us.html">contact us</a></li>
<li><a href="about_us.html">about us</a></li>
<li><a href="index.html">home</a></li>
</ul>
</div>
<div id="header_data">
<div id="logo">
<a href="index.html"><img src="images/logo.gif" alt="Wilkins Hammond Logo" border="0" /></a>
</div>
<div id="address_phone">
<span id="phone_number"> 01246 232853</span>
<div id="address_bar">
Devon House, 28 Gluman Gate, Chesterfield, S40 1TX<br />
<img src="images/Marketing_headerImage.jpg" alt="Header Bar" width="770" height="19" />
</div>
</div>
</div>
</div>
<!-- Content -->
<div id="container">
<div id="left">
<div id="top_buttons"><a href="landlords.html"><img src="images/landlordbutton.jpg" alt="Landlords" width="170" height="30" /></a><a href="tenants.html"><img src="images/tennantbutton.jpg" alt="Tenants" width="170" height="30" /></a></div>
<div id="middle_buttons">
<form action="show_lettings.php" method="get" enctype="multipart/form-data">
<table width="100%" border="0" cellspacing="2" cellpadding="0">
<tr>
<td colspan="2" bgcolor="#FE0000"><strong>Quick Property Search</strong></td>
</tr>
<tr>
<td>Type</td>
<td><label>
<select name="type" id="type">
<option value="Apartment">Apartment</option>
<option value="House">House</option>
<option value="Bungalow">Bungalow</option>
<option value="">Any</option>
</select>
</label></td>
</tr>
<tr>
<td> Beds</td>
<td><label>
<select name="beds" id="beds">
<option value="1">1</option>
<option value="2">2</option>
<option value="3">3</option>
<option value="4">4</option>
<option value="5">5</option>
</select>
</label></td>
</tr>
<tr>
<td>Rent pcm</td>
<td><label>
<select name="rent" id="rent">
<option value="400">up to £400</option>
<option value="500">up to £500</option>
<option value="600">up to £600</option>
<option value="700">up to £700</option>
<option value="1000">up to £1000</option>
</select>
</label></td>
</tr>
<tr>
<td> </td>
<td><input type="submit" name="search" id="search" value="Search" /></td>
</tr>
<tr>
<td colspan="2" bgcolor="#ECE9D8"><a href="show_all_lettings.php">Show all property</a></td>
</tr>
</table>
</form>
</div>
<div id="middle_buttons">
<table width="100%" border="0" cellspacing="2" cellpadding="0" class="myForm">
<tr>
<td bgcolor="#FE0000"><strong>Information for Tenants</strong></td>
</tr>
<tr>
<td><a href="tenants_why_us.html">Why Choose Us?</a></td>
</tr>
<tr>
<td><a href="tenants_tdc.html">Tenancy Deposit Scheme</a></td>
</tr>
<tr>
<td><a href="tenants_application.html">Making an application</a></td>
</tr>
</table>
</div>
<div id="master_buttons"><a href="commercial.html"><img src="images/commbutton.jpg" alt="Commercial" width="170" height="50" /></a><a href="lettings.html"><img src="images/lettbutton.jpg" alt="Lettings" width="170" height="50" /></a><a href="land.html"><img src="images/landbutton.jpg" alt="Land" width="170" height="50" /></a> </div>
</div>
<div id="right">
<h1>Search result</h1>
<h4><?php echo $totalRows_lettings ?> properties match your search .</h4>
<?php if ($totalRows_lettings > 0) { // Show if recordset not empty ?>
<div id="search_matches">
<?php do { ?>
<table width="100%" border="0" cellspacing="2" cellpadding="3">
<tr>
<td width="205" bgcolor="#999999"><h4><?php echo $row_lettings['property_type']; ?>, <?php echo $row_lettings['property_status']; ?></h4></td>
<td colspan="2" bgcolor="#999999"><h4><?php echo $row_lettings['number_name']; ?>, <?php echo $row_lettings['address_1']; ?> <?php echo $row_lettings['address_2']; ?>, <?php echo $row_lettings['area']; ?>, <?php echo $row_lettings['town_city']; ?></h4></td>
</tr>
<tr>
<td><div align="center"><img src="<?php echo $row_lettings['image_path']; ?>" /></div></td>
<td colspan="2" valign="top"><label><?php echo $row_lettings['detail']; ?></label>
<p> </p></td>
</tr>
<tr>
<td bgcolor="#FE0000"><h4><a href="gallery.php?lett_ID=<?php echo $row_lettings['lett_ID']; ?>">Image gallery</a></h4></td>
<td bgcolor="#FE0000"><h4><a href="<?php echo $row_lettings['file_path']; ?>" target="_blank">Find out more</a>| <a href="arrange_viewing.php?lett_ID=<?php echo $row_lettings['lett_ID']; ?>">Arrange a viewing</a> </h4></td>
<td bgcolor="#FE0000"><h4 align="right">Rent £<?php echo $row_lettings['rent']; ?> pcm Bond £<?php echo $row_lettings['bond']; ?></h4></td>
</tr>
<tr>
<td> </td>
<td> </td>
<td> </td>
</tr>
</table>
<?php } while ($row_lettings = mysql_fetch_assoc($lettings)); ?>
</div>
<?php } // Show if recordset not empty ?>
<?php if ($totalRows_lettings == 0) { // Show if recordset empty ?>
<div id="search_matches">
<h2>No matches for your search? Here are some other properties you may be interested in, or alternatively, <a href="contact_us.html">let us know what you're looking for.</a> </h2>
<?php do { ?>
<br />
<table width="100%" border="0" cellspacing="2" cellpadding="2">
<tr bgcolor="#999999">
<td width="205"><h4><?php echo $row_all_lett['property_type']; ?>, <?php echo $row_all_lett['property_status']; ?></h4></td>
<td colspan="2"><h4><?php echo $row_all_lett['number_name']; ?>, <?php echo $row_all_lett['address_1']; ?> <?php echo $row_all_lett['address_2']; ?>, <?php echo $row_all_lett['area']; ?>, <?php echo $row_all_lett['town_city']; ?></h4></td>
</tr>
<tr>
<td><div align="center"><img src="<?php echo $row_all_lett['image_path']; ?>" alt="Image" /></div></td>
<td colspan="2" valign="top"><p><?php echo $row_all_lett['detail']; ?></p>
<p> </p></td>
</tr>
<tr bgcolor="#FE0000">
<td><h4><a href="gallery.php?lett_ID=<?php echo $row_all_lett['lett_ID']; ?>">Image gallery</a></h4></td>
<td><h4><a href="<?php echo $row_all_lett['file_path']; ?>">Find out more</a> | <a href="arrange_viewing.php?lett_ID=<?php echo $row_all_lett['lett_ID']; ?>">Arrange a viewing</a></h4></td>
<td><h4>Rent £<?php echo $row_all_lett['rent']; ?> Bond £<?php echo $row_all_lett['bond']; ?></h4></td>
</tr>
<tr>
<td> </td>
<td> </td>
<td> </td>
</tr>
</table>
<?php } while ($row_all_lett = mysql_fetch_assoc($all_lett)); ?>
</div>
<?php } // Show if recordset empty ?>
</div>
</div>
<!-- Footer -->
<div id="footer">
<div id="footer_data"><a href="http://www.rics.org"><img src="images/RICS logo.gif" alt="RICS Logo" width="68" height="77" border="0" align="right" /></a>© <strong><span id="wilkins_hammond">Wilkins Hammond</span> 2009</strong><br />
<span id="wilkins_hammond">Wilkins Hammond</span>, 'Devon House', 28 Gluman Gate, Chesterfield, S40 1TX<br />
Commercial & Land Tel: 01246 555511 | Lettings & Management Tel: 01246 232853<br />
<br />
<a href="legal.html">Legal</a> | Website by <a href="http://www.greenfrogcomputing.co.uk">Greenfrog Computing Ltd</a></div>
</div>
<!-- Google Tracking Code -->
<script type="text/javascript">
var gaJsHost = (("https:" == document.location.protocol) ? "https://ssl." : "http://www.");
document.write(unescape("%3Cscript src='" + gaJsHost + "google-analytics.com/ga.js' type='text/javascript'%3E%3C/script%3E"));
</script>
<script type="text/javascript">
try {
var pageTracker = _gat._getTracker("UA-10622354-1");
pageTracker._trackPageview();
} catch(err) {}</script>
</body>
</html>
<?php
mysql_free_result($lettings);
mysql_free_result($all_lett);
?>
|
|
|
|
10-21-2009, 12:14 AM
|
#2 (permalink)
|
|
The Addict
Join Date: May 2009
Posts: 287
Thanks: 5
|
PHP Code:
<?php require_once('Connections/wilkins.php'); ?>
<?php
if (!function_exists("GetSQLValueString")) {
function GetSQLValueString($theValue, $theType, $theDefinedValue = "", $theNotDefinedValue = "")
{
$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;
}
}
$currentPage = $_SERVER["PHP_SELF"];
$type_lettings = "-1";
if (isset($_REQUEST["type"])) {
$type_lettings = $_REQUEST["type"];
}
$bedrooms_lettings = "-1";
if (isset($_REQUEST["beds"])) {
$bedrooms_lettings = $_REQUEST["beds"];
}
$rentamount_lettings = "-1";
if (isset($_REQUEST["rent"])) {
$rentamount_lettings = $_REQUEST["rent"];
}
mysql_select_db($database_wilkins, $wilkins);
$query_lettings = sprintf("SELECT * FROM lett_property, teaser, instructions WHERE teaser.property_ID = lett_property.lett_ID AND lett_property.property_type = %s AND lett_property.beds = %s AND lett_property.rent < %s AND teaser.property_ID = instructions.property_ID GROUP BY lett_property.lett_ID ORDER BY lett_property.rent ", GetSQLValueString($type_lettings, "text"),GetSQLValueString($bedrooms_lettings, "int"),GetSQLValueString($rentamount_lettings, "int"));
$lettings = mysql_query($query_lettings, $wilkins) or die(mysql_error());
$row_lettings = mysql_fetch_assoc($lettings);
$totalRows_lettings = mysql_num_rows($lettings);
mysql_select_db($database_wilkins, $wilkins);
$query_all_lett = "SELECT * FROM lett_property, teaser, instructions WHERE teaser.property_ID = lett_property.lett_ID AND teaser.property_ID = instructions.property_ID GROUP BY lett_property.lett_ID ORDER BY lett_property.rent ASC";
$all_lett = mysql_query($query_all_lett, $wilkins) or die(mysql_error());
$row_all_lett = mysql_fetch_assoc($all_lett);
$totalRows_all_lett = mysql_num_rows($all_lett);
$queryString_lettings = "";
if (!empty($_SERVER['QUERY_STRING'])) {
$params = explode("&", $_SERVER['QUERY_STRING']);
$newParams = array();
foreach ($params as $param) {
if (stristr($param, "pageNum_lettings") == false &&
stristr($param, "totalRows_lettings") == false) {
array_push($newParams, $param);
}
}
if (count($newParams) != 0) {
$queryString_lettings = "&" . htmlentities(implode("&", $newParams));
}
}
$queryString_lettings = sprintf("&totalRows_lettings=%d%s", $totalRows_lettings, $queryString_lettings);
?><!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">
<!-- Website design and hosting by Greenfrog Computing Ltd -->
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Wilkins Hammond Lettings & Management, Commercial & Land Services</title>
<link href="css/layout.css" rel="stylesheet" type="text/css" />
<script src="Scripts/AC_RunActiveContent.js" type="text/javascript"></script>
</head>
<body>
<!-- Header -->
<div id="header">
<div id="top_nav">
<ul id="navigation">
<li><a href="meet_us.html">meet us</a></li>
<li><a href="find_us.html">find us</a></li>
<li><a href="contact_us.html">contact us</a></li>
<li><a href="about_us.html">about us</a></li>
<li><a href="index.html">home</a></li>
</ul>
</div>
<div id="header_data">
<div id="logo">
<a href="index.html"><img src="images/logo.gif" alt="Wilkins Hammond Logo" border="0" /></a>
</div>
<div id="address_phone">
<span id="phone_number"> 01246 232853</span>
<div id="address_bar">
Devon House, 28 Gluman Gate, Chesterfield, S40 1TX<br />
<img src="images/Marketing_headerImage.jpg" alt="Header Bar" width="770" height="19" />
</div>
</div>
</div>
</div>
<!-- Content -->
<div id="container">
<div id="left">
<div id="top_buttons"><a href="landlords.html"><img src="images/landlordbutton.jpg" alt="Landlords" width="170" height="30" /></a><a href="tenants.html"><img src="images/tennantbutton.jpg" alt="Tenants" width="170" height="30" /></a></div>
<div id="middle_buttons">
<form action="show_lettings.php" method="get" enctype="multipart/form-data">
<table width="100%" border="0" cellspacing="2" cellpadding="0">
<tr>
<td colspan="2" bgcolor="#FE0000"><strong>Quick Property Search</strong></td>
</tr>
<tr>
<td>Type</td>
<td><label>
<select name="type" id="type">
<option value="Apartment">Apartment</option>
<option value="House">House</option>
<option value="Bungalow">Bungalow</option>
<option value="">Any</option>
</select>
</label></td>
</tr>
<tr>
<td> Beds</td>
<td><label>
<select name="beds" id="beds">
<option value="1">1</option>
<option value="2">2</option>
<option value="3">3</option>
<option value="4">4</option>
<option value="5">5</option>
</select>
</label></td>
</tr>
<tr>
<td>Rent pcm</td>
<td><label>
<select name="rent" id="rent">
<option value="400">up to £400</option>
<option value="500">up to £500</option>
<option value="600">up to £600</option>
<option value="700">up to £700</option>
<option value="1000">up to £1000</option>
</select>
</label></td>
</tr>
<tr>
<td> </td>
<td><input type="submit" name="search" id="search" value="Search" /></td>
</tr>
<tr>
<td colspan="2" bgcolor="#ECE9D8"><a href="show_all_lettings.php">Show all property</a></td>
</tr>
</table>
</form>
</div>
<div id="middle_buttons">
<table width="100%" border="0" cellspacing="2" cellpadding="0" class="myForm">
<tr>
<td bgcolor="#FE0000"><strong>Information for Tenants</strong></td>
</tr>
<tr>
<td><a href="tenants_why_us.html">Why Choose Us?</a></td>
</tr>
<tr>
<td><a href="tenants_tdc.html">Tenancy Deposit Scheme</a></td>
</tr>
<tr>
<td><a href="tenants_application.html">Making an application</a></td>
</tr>
</table>
</div>
<div id="master_buttons"><a href="commercial.html"><img src="images/commbutton.jpg" alt="Commercial" width="170" height="50" /></a><a href="lettings.html"><img src="images/lettbutton.jpg" alt="Lettings" width="170" height="50" /></a><a href="land.html"><img src="images/landbutton.jpg" alt="Land" width="170" height="50" /></a> </div>
</div>
<div id="right">
<h1>Search result</h1>
<h4><?php echo $totalRows_lettings ?> properties match your search .</h4>
<?php if ($totalRows_lettings > 0) { // Show if recordset not empty ?>
<div id="search_matches">
<?php do { ?>
<table width="100%" border="0" cellspacing="2" cellpadding="3">
<tr>
<td width="205" bgcolor="#999999"><h4><?php echo $row_lettings['property_type']; ?>, <?php echo $row_lettings['property_status']; ?></h4></td>
<td colspan="2" bgcolor="#999999"><h4><?php echo $row_lettings['number_name']; ?>, <?php echo $row_lettings['address_1']; ?> <?php echo $row_lettings['address_2']; ?>, <?php echo $row_lettings['area']; ?>, <?php echo $row_lettings['town_city']; ?></h4></td>
</tr>
<tr>
<td><div align="center"><img src="<?php echo $row_lettings['image_path']; ?>" /></div></td>
<td colspan="2" valign="top"><label><?php echo $row_lettings['detail']; ?></label>
<p> </p></td>
</tr>
<tr>
<td bgcolor="#FE0000"><h4><a href="gallery.php?lett_ID=<?php echo $row_lettings['lett_ID']; ?>">Image gallery</a></h4></td>
<td bgcolor="#FE0000"><h4><a href="<?php echo $row_lettings['file_path']; ?>" target="_blank">Find out more</a>| <a href="arrange_viewing.php?lett_ID=<?php echo $row_lettings['lett_ID']; ?>">Arrange a viewing</a> </h4></td>
<td bgcolor="#FE0000"><h4 align="right">Rent £<?php echo $row_lettings['rent']; ?> pcm Bond £<?php echo $row_lettings['bond']; ?></h4></td>
</tr>
<tr>
<td> </td>
<td> </td>
<td> </td>
</tr>
</table>
<?php } while ($row_lettings = mysql_fetch_assoc($lettings)); ?>
</div>
<?php } // Show if recordset not empty ?>
<?php if ($totalRows_lettings == 0) { // Show if recordset empty ?>
<div id="search_matches">
<h2>No matches for your search? Here are some other properties you may be interested in, or alternatively, <a href="contact_us.html">let us know what you're looking for.</a> </h2>
<?php do { ?>
<br />
<table width="100%" border="0" cellspacing="2" cellpadding="2">
<tr bgcolor="#999999">
<td width="205"><h4><?php echo $row_all_lett['property_type']; ?>, <?php echo $row_all_lett['property_status']; ?></h4></td>
<td colspan="2"><h4><?php echo $row_all_lett['number_name']; ?>, <?php echo $row_all_lett['address_1']; ?> <?php echo $row_all_lett['address_2']; ?>, <?php echo $row_all_lett['area']; ?>, <?php echo $row_all_lett['town_city']; ?></h4></td>
</tr>
<tr>
<td><div align="center"><img src="<?php echo $row_all_lett['image_path']; ?>" alt="Image" /></div></td>
<td colspan="2" valign="top"><p><?php echo $row_all_lett['detail']; ?></p>
<p> </p></td>
</tr>
<tr bgcolor="#FE0000">
<td><h4><a href="gallery.php?lett_ID=<?php echo $row_all_lett['lett_ID']; ?>">Image gallery</a></h4></td>
<td><h4><a href="<?php echo $row_all_lett['file_path']; ?>">Find out more</a> | <a href="arrange_viewing.php?lett_ID=<?php echo $row_all_lett['lett_ID']; ?>">Arrange a viewing</a></h4></td>
<td><h4>Rent £<?php echo $row_all_lett['rent']; ?> Bond £<?php echo $row_all_lett['bond']; ?></h4></td>
</tr>
<tr>
<td> </td>
<td> </td>
<td> </td>
</tr>
</table>
<?php } while ($row_all_lett = mysql_fetch_assoc($all_lett)); ?>
</div>
<?php } // Show if recordset empty ?>
</div>
</div>
<!-- Footer -->
<div id="footer">
<div id="footer_data"><a href="http://www.rics.org"><img src="images/RICS logo.gif" alt="RICS Logo" width="68" height="77" border="0" align="right" /></a>© <strong><span id="wilkins_hammond">Wilkins Hammond</span> 2009</strong><br />
<span id="wilkins_hammond">Wilkins Hammond</span>, 'Devon House', 28 Gluman Gate, Chesterfield, S40 1TX<br />
Commercial & Land Tel: 01246 555511 | Lettings & Management Tel: 01246 232853<br />
<br />
<a href="legal.html">Legal</a> | Website by <a href="http://www.greenfrogcomputing.co.uk">Greenfrog Computing Ltd</a></div>
</div>
<!-- Google Tracking Code -->
<script type="text/javascript">
var gaJsHost = (("https:" == document.location.protocol) ? "https://ssl." : "http://www.");
document.write(unescape("%3Cscript src='" + gaJsHost + "google-analytics.com/ga.js' type='text/javascript'%3E%3C/script%3E"));
</script>
<script type="text/javascript">
try {
var pageTracker = _gat._getTracker("UA-10622354-1");
pageTracker._trackPageview();
} catch(err) {}</script>
</body>
</html>
<?php
mysql_free_result($lettings);
mysql_free_result($all_lett);
?>
(Simple Fix!) You could link in JavaScript to just select all of the boxes.
- Won't work, you're using an option tag.
Fix #2 -
Why not set the value of the "Any" to something similar to this?
PHP Code:
// Might need quotes, I'm not positive.
Apartment OR House OR Bungalow
I would just check to see that when that value is submitted that it matches EXACTLY with what it's supposed to be.
|
|
|
|
10-21-2009, 11:03 AM
|
#3 (permalink)
|
|
The Wanderer
Join Date: Oct 2009
Posts: 6
Thanks: 1
|
thanks for feedback, still no go tho...:(
Thanks for your quick response :)
Ok I entered the Apartment OR House OR Bungalow into my option tag like so
<select name="type" id="type">
<option value="Apartment">Apartment</option>
<option value="House">House</option>
<option value="Bungalow">Bungalow</option>
<option value="Apartment OR House OR Bungalow">Any</option>
</select>
The output string is
http://www.wilkins-hammond.com/show_...&search=Search
I still get no matches...
Any other ideas?
When I defined the variables in the Dreamweaver Recordset dialogue box, it asks for a default value, which tutorials say to put -1
Could this be stopping me from being able to an option like this
<select name="type" id="type">
<option value="Apartment">Apartment</option>
<option value="House">House</option>
<option value="Bungalow">Bungalow</option>
<option value="">Any</option>
</select>
I guess if I don't submit a value, it uses the default (-1) which of course matches nothing in the database. Is there another value I could use that would match everything?
Thanks again
Rich...:)
|
|
|
|
10-21-2009, 11:11 PM
|
#4 (permalink)
|
|
The Addict
Join Date: May 2009
Posts: 287
Thanks: 5
|
There is always the usage of a variable ('%' if my memory serves correctly), however I would not suggest that you just place that in the HTML. I would use 'all' and then add in the variable once you verify that they are searching for all options.
|
|
|
|
10-22-2009, 03:49 PM
|
#5 (permalink)
|
|
The Wanderer
Join Date: Oct 2009
Posts: 6
Thanks: 1
|
Where would I put the "%"...
Thanks for the reply...
How would I send a "%" once the user has chosen "any" from the option menu, if "%" is not the value in the option menu?
I also tried changing the -1 for a % in the default value but that made no difference...
Puzzled...
Rich...:)
|
|
|
|
10-22-2009, 09:57 PM
|
#6 (permalink)
|
|
The Addict
Join Date: May 2009
Posts: 287
Thanks: 5
|
Quote:
Originally Posted by rix1505
Thanks for the reply...
How would I send a "%" once the user has chosen "any" from the option menu, if "%" is not the value in the option menu?
I also tried changing the -1 for a % in the default value but that made no difference...
Puzzled...
Rich...:)
|
PHP Code:
if (isset($_REQUEST["type"])) {
$type_lettings = $_REQUEST["type"];
if ($_REQUEST["type"] == 'any') {
$type_lettings = '%';
}
}
Or something like that.
|
|
|
|
|
The Following User Says Thank You to adamdecaf For This Useful Post:
|
|
10-23-2009, 10:06 AM
|
#7 (permalink)
|
|
The Wanderer
Join Date: Oct 2009
Posts: 6
Thanks: 1
|
Genius - that's cracked it!!
Thank you adamdecaf,
I changed my SQL statement as well to use the LIKE operator, and it works!
Brilliant.
Cheers
Rich...:)
|
|
|
|
|
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
|
|
|
| Thread Tools |
Search this Thread |
|
|
|
| Display Modes |
Linear Mode
|
Posting Rules
|
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
HTML code is Off
|
|
|
|