ebanbury 13 Junior Poster

Hello
I would also like to have a form, where users can input their search criteria and then the results show on the same page in a table.

Currently absolutely nothing happens.:-(

<?php require_once('Connections/iwalletc_localhost.php'); ?>
<?php
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_iwalletc_localhost, $iwalletc_localhost);
$query_rs_areas = "SELECT * FROM property_areas";
$rs_areas = mysql_query($query_rs_areas, $iwalletc_localhost) or die(mysql_error());
$row_rs_areas = mysql_fetch_assoc($rs_areas);
$totalRows_rs_areas = mysql_num_rows($rs_areas);
?>



<!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>Property Search</title>
</head>

<body>


<style type="text/css">
@import url("images/style.css");
#apDiv2 {
	position:absolute;
	width:437px;
	height:43px;
	z-index:1;
	text-align: center;
	left: 8px;
	top: 45px;
}
#apDiv3 {
	position:absolute;
	width:417px;
	height:42px;
	z-index:2;
	left: -82px;
	top: 3px;
	text-align: center;
}
#apDiv {	position:absolute;
	width:504px;
	height:211px;
	z-index:1;
	left: 2px;
	top: 106px;
	text-align: right;
}
#apDiv4 {	position:absolute;
	width:313px;
	height:20px;
	z-index:3;
	left: 191px;
	top: 148px;
}
#apDiv5 {
	position:absolute;
	width:438px;
	height:362px;
	z-index:2;
	top: 95px;
	left: 10px;
}
</style>
</head>

<body>
<div class="titletext" id="apDiv2">Search listings</div>
<div id="apDiv5">
  <form id="form1" name="form1" method="get" action="search2.php">
    <table width="313" height="303" align="left">
      <tr valign="baseline">
        <td nowrap="nowrap" align="right">Sale type:</td>
        <td><select name="prop_type" id="prop_type">
          <option value="Residential">Residential</option>
          <option value="Commercial">Commercial</option>
          <option value="Land">Land</option>
          <option value="New Developments">New Developments</option>
        </select></td>
      </tr>
      <tr valign="baseline">
        <td nowrap="nowrap" align="right">Home type:</td>
        <td><select name="prop_saletype" id="prop_saletype">
          <option value="House">House</option>
          <option value="Cluster">Cluster</option>
          <option value="Apartment">Apartment</option>
</select></td>
      </tr>
      <tr valign="baseline">
        <td nowrap="nowrap" align="right">Price:</td>
        <td><input name="prop_price" type="text" id="prop_price" value="" size="32" /></td>
      </tr>
      <tr valign="baseline">
        <td nowrap="nowrap" align="right">Bedrooms:</td>
        <td><select name="prop_bedroom" id="prop_bedroom">
          <option value="0">0</option>
          <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></td>
      </tr>
      <tr valign="baseline">
        <td nowrap="nowrap" align="right">Bathrooms:</td>
        <td><select name="prop_bathroom" id="prop_bathroom">
          <option value="1">1</option>
          <option value="2">2</option>
          <option value="3">3</option>
          <option value="4">4+</option>
        </select></td>
      </tr>
      <tr valign="baseline">
        <td nowrap="nowrap" align="right">Suburb:</td>
        <td><label for="local_area"></label>
          <select name="local_area" id="local_area">
            <?php
do {  
?>
            <option value="<?php echo $row_rs_areas['area_name']?>"><?php echo $row_rs_areas['area_name']?></option>
            <?php
} while ($row_rs_areas = mysql_fetch_assoc($rs_areas));
  $rows = mysql_num_rows($rs_areas);
  if($rows > 0) {
      mysql_data_seek($rs_areas, 0);
	  $row_rs_areas = mysql_fetch_assoc($rs_areas);
  }
?>
          </select></td>
      </tr>
      <tr valign="baseline">
        <td nowrap="nowrap" align="right">&nbsp;</td>
        <td>&nbsp;</td>
      </tr>
      <tr valign="baseline">
        <td nowrap="nowrap" align="right">&nbsp;</td>
        <td><input type="submit" value="Search" /></td>
      </tr>
    </table>
  </form>
</div>
<div id="apDiv3">
  
      
    </div>
  </div>
</div>
</body>
</html>
<?php
mysql_free_result($rs_areas);
?>
</body>
</html>
Be a part of the DaniWeb community

We're a friendly, industry-focused community of 1.20 million developers, IT pros, digital marketers, and technology enthusiasts learning and sharing knowledge.