Sorry this is so basic, how to do an equal or greater than filter

2 posts by 2 authors in: Forums > CMS Builder
Last Post: January 25, 2017   (RSS)

By willydoit - January 25, 2017

Hi all,

apologies if this is a real basic question.

I have a search form which displays apartments which can sleep the number of people chosen from the dropdown list (thanks cmsb cookbook) however I want the form to return apartments which are not just equal to but also greater than the number selected.

For example if there are 4 guests the list displays apartments which will accommodate 4 guests, I want it to display all apartments which can display equal to or greater than the number selected.

My existing code is below, 'sleeps' is the field containing the numeric number, how do I need to amend it to list equal or greater than the number selected and then sort it into ascending numerical order?

Thanks in advance for any help provided.

<form method="POST" action="<?php echo $_SERVER['PHP_SELF'] ?>">
<select name = "sleeps" > 
<option value="">How Many Guests</option>
<?php foreach (getListOptions('apartments', 'sleeps') as $value => $label): ?> 
     
<option value = "<?php echo $value;?>" <?php selectedIf($value, @$_REQUEST['sleeps']);?>>
    
<?php echo $label; ?></option> 
     
<?php endforeach ?> 
 
</select> 

<input type="submit" name="submit" value="Search" >
</form>