PHP - Looping inside a loop, maybe?
<p>I am currently using a foreach loop to display some radio buttons like so</p>

<pre><code>&lt;?php
foreach($roles as $role){
    $output .= '&lt;div class="row"&gt;';
    $output .= '    &lt;input name="_'.$role-&gt;key.'" type="radio" id="'.$role-&gt;key.'" class="radio" /&gt;';
    $output .= '    &lt;label for="'.$role-&gt;key.'" style="text-transform: lowercase;"&gt;'.$role-&gt;name.'&lt;/label&gt;';
    $output .= '&lt;/div&gt;';
}
</code></pre>

<p>?></p>

<p>So thats fairly straight forward .... The bit that i need to do next is confusing ... i need to take the $role->key and see if it matches an entry in another table, if so, echo 'checked="checked"' on the radio button.</p>

<p>It will need to be matched by the $role->key and also the $userid.</p>

<p>Any help would be great.</p>
