I have a dropdown list in a form, which holds the values of the options. Once submitted I want to change the query based on which option I chose.
My form:
<form method="get" name="datum" id="datum-form" onchange="document.getElementById('datum-form').submit()">
<select id="datum" class="form-control">
<option value="">Select Filter</option>
<option value="0-30">0-30</option>
<option value="30-60">30-60</option>
<option value="60-99999">60-99999</option>
</select>
</form>
My Controller:
public static function getCalls($id)
{
if ($_GET['datum'] == "60-99999") {
$sDates = explode("-", $_GET);
$aCalls = // query
} elseif ($_GET['datum'] == "30-60") {
$sDates = explode("-", $_GET);
$aCalls = // query
} else {
$aCalls = // query
}
return $aCalls;
}
}
As an example, once submitted my $_GET holds:
array(1) { ["datum"]=> string(8) "60-99999" }
With this value I'd want the
if ($_GET == "60-99999")
query to show.