JSFiddle - React, Tailwind, and code Playground
HTML
<select name="bedrooms" id="bedrooms">
<option value="0" selected>Choose One:</option>
<option value="1">1 bed+</option>
<option value="2">2 beds+</option>
<option value="3">3 beds+</option>
</select>
<div id="resultsDiv"></div>
JavaScript
$('#bedrooms').change(function() {
var beds = $(this).val();
alert('Minimum beds: ' + beds);
$.ajax({
type: "POST",
url: "somephpfilename.php",
data: 'num_beds=' + beds,
success: function(recd){
$('#resultsDiv').html(recd);
} //END ajax success fn
}); //END ajax code block
}); //END select.change fn
/************************************************************
// Save the below code into a file called: somephpfilename.php
<?php
$min_beds = $_POST['num_beds'];
$query = "SELECT * IN `yourtablename` WHERE `cp_bedrooms` > '$min_beds' ORDER BY `cp_bedrooms`";
$results = mysql_query($query) or die(mysql_error());
$out = '
<table id="foundApts">
<tr>
<th>Num Beds</th>
<th>Address</th>
<th>Contact Phone</th>
<th>Rent</th>
</tr>
';
while ($row = mysql_fetch_assoc($results){
$out .= '
<tr>
<td>' .$row['cp_bedrooms']. '</td>
<td>' .$row['address_field_name']. '</td>
<td>' .$row['phonenum_field_name']. '</td>
<td>' .$row['rentprice_field_name']. '</td>
</tr>
';
}
$out .= '</table>';
echo $out;
?>
*********************************************************************/