PDA

View Full Version : Horizontal Search Bar Code



Anonymous
01-21-2003, 02:04 PM
Hi Friends

Here is a horizontal search bar for anyone interested. Change select options to fit your own program.


<table>

<td>
<td>
<form name="reference" action="listingsearch.php" method="get"><input type="text" name="mls" size="4" maxlength="4">
<td><input type="submit" value="Send" class="buttons"></td>
</td>
<td></form></td>



<td width="17" height="27" bgcolor="#E6E6E6">
<form name="form" action="listingsearch.php" method="get">
</td>

<td width="101" height="27" bgcolor="#E6E6E6">

<select name="negocio"
<option value="Buy">Buy</option>
<option value="Lease">Lease</option>

</select>


<td width="101" height="27" bgcolor="#E6E6E6">
<select name="type">
<option value="Apartment">Apartment</option>
<option value="Office">Office</option>

</select>
</td>




<td><input type="submit" value="Send" class="buttons">
</td> </form>

</td>
</table>
</td>
</tr>
</table>

Cheers
Luis

mfruech
01-21-2003, 06:54 PM
Do you have a demo where we can view this?

Anonymous
03-03-2003, 01:46 AM
here is the code I am using for horizontal search bar. Its working fine for me.

In style.php add this--------------

// builds a pulldown menu without captions------------------------

function searchbox_pulldown_simp ($browse_field_name)
{
global $conn, $config;
echo "<select name=\"$browse_field_name\">";
$sql = "SELECT listingsDBElements.field_value, listingsDB.ID, count(field_value) AS num_type FROM listingsDBElements, listingsDB WHERE listingsDBElements.field_name = '$browse_field_name' AND listingsDB.active = 'yes' AND listingsDBElements.listing_id = listingsDB.ID ";
if ($config[use_expiration] == "yes")
{
$sql .= " AND expiration > ".$conn->DBDate(time());
}
$sql .= "GROUP BY listingsDBElements.field_value ORDER BY listingsDBElements.field_value";
$recordSet = $conn->Execute($sql);
if ($recordSet === false) log_error($sql);
while (!$recordSet->EOF)
{
$field_output = make_db_unsafe ($recordSet->fields[field_value]);
$num_type = $recordSet->fields[num_type];
echo "<option name=\"$browse_field_name\" value=\"$field_output\">$field_output ($num_type)";
$recordSet->MoveNext();
} // end while
echo "</select>";
} // end function searchbox_pulldown_simp------------------------------


In any page u want add this-------"with your modifications"

<table>
<tr>
<td>
<form name="formu" action="listingsearch.php" method="get">
</td>

<td><FONT COLOR="#808080"><B></b></font>

<select name="business">
<option value="Sell">Sell</option>
<option value="Rent">Rent</option>
</select>
</td>

<td ><? searchbox_pulldown_simp("type") ?></td>
<td><? searchbox_pulldown_simp("city") ?></td>

<td><input style="background-color: #C0C0C0; font-weight: bold;" type="submit" value="Submit">
</td> </form>

</td>
</tr>
</table>

<!--end horiz srch bar-->

I am using this on an intranet project, so have no sample to be viewd. Its works...........

Regards
luis :D

Anonymous
03-03-2003, 01:50 AM
Please note that the

<select name="business">
<option value="Sell">Sell</option>
<option value="Rent">Rent</option>
</select>

is specific to my program but the

<td ><? searchbox_pulldown_simp("type") ?></td>
<td><? searchbox_pulldown_simp("city") ?></td>

is generic, can be used by OR users with original scripts.

In conclusion u can use the whole code accept the selectbox bit that has to apply to your own script.

Regards
Luis :D