Filter by Select Attribute

Permalink
Hey! I have been trying and trying to figure out how to filter a select attribute all day. Figured out (thanks to JordanLev) how to display it dynamically but now how to filter the blasted thing. Alright. Here's my PHP/HTML to display:

<span class='attribute_answer'>
            <select name="annual_rainfall">
               <option value="0">--</option>
         <?php
            Loader::model('attribute/type');
            Loader::model('attribute/categories/collection');
            $ak = UserAttributeKey::getByHandle('annual_rainfall');
            $satc = new SelectAttributeTypeController(AttributeType::getByHandle('select'));
            $satc->setAttributeKey($ak);
            $values = $satc->getOptions();
            foreach ($values as $v) {
                echo "<option id='".$v->ID."' value=".$v->ID.">".$v->value."</option>";
            }
         ?>
            </select>


And here's how I'm trying to filter (and it's not working at all):

$annual_rainfall = htmlentities(trim($_GET['annual_rainfall']));
$userList->filterByAnnualRainfall('annual_rainfall', $annual_rainfall, '=');


The annual rainfall is an user attribute too if that means anything. :)

rainmaker
 
rainmaker replied on at Permalink Reply
rainmaker
Pretty please?
rainmaker replied on at Permalink Best Answer Reply
rainmaker
GOT IT!! Just in case anyone else needs it:

$annual_rainfall = "\n$annual_rainfall\n";
echo $annual_rainfall;
$userList->filterByAnnualRainfall($annual_rainfall);