simplify this PHP code?
<p>any ideas?
in the second case $v is an array
I could do is_array($v), but I'd have to repeat the if/else anyway</p>

<pre><code>foreach(array('city', 'location') as $f) {
        $ors[$f] = array();

        if (!isset($_POST[$f])) continue;

        $v = $_POST[$f];
        if (isset($df[$f][$v])) {
                array_push($ors[$f], $df[$f][$v]);
        }
        else {
                security_error();
        }
}

foreach(array('age', 'sex') as $f) {
        $ors[$f] = array();

        if (!isset($_POST[$f])) continue;

        foreach($_POST[$f] as $v) {
                if (isset($df[$f][$v])) {
                        array_push($ors[$f], $df[$f][$v]);
                }
                else {
                        security_error();
                }
        }
}
</code></pre>
