Search needs tweaking

3 posts by 2 authors in: Forums > CMS Builder
Last Post: February 1, 2013   (RSS)

http://www.mesaverderentals.com/2index.php

they would to search for like all pools to show up and it not require a city

here is my city code 

<select name="City" class="dropdown" id="type" size="1" style="font-family: Verdana; color: #800000; ">
<option selected>REQUIRED: Select A City</option>
<?php
$schema = loadSchema('rentals');
$fieldSchema = $schema['City'];
$fieldOptions = getListOptionsFromSchema($fieldSchema);

foreach ($fieldOptions as $valueAndLabel) {
list($value,$label) = $valueAndLabel;
$encodedValue = htmlspecialchars($value);
$encodedLabel = htmlspecialchars($label);
print "<option value=\"$encodedValue\">$encodedLabel</option>\n";
}
?>
</select>

Is there a better way to do this so cities arent required??

thanks

Patricia

www.thenetgirl.com

Hi,

You should just need to add an empty value to the Select A City option:

<select name="City" class="dropdown" id="type" size="1" style="font-family: Verdana; color: #800000; "> 
<option value="" selected="selected" >Select A City</option>
<?php
$schema = loadSchema('rentals'); 
$fieldSchema = $schema['City']; 
$fieldOptions = getListOptionsFromSchema($fieldSchema);

foreach ($fieldOptions as $valueAndLabel) { 
list($value,$label) = $valueAndLabel;
$encodedValue = htmlspecialchars($value); 
$encodedLabel = htmlspecialchars($label); 
print "<option value=\"$encodedValue\">$encodedLabel</option>\n"; 

?>
</select>

Thanks!

Greg

Greg Thomas







PHP Programmer - interactivetools.com