How can I get the saved value in the variable table to show on a form? I have a form that gets values set in the variable table if any have been submitted. All of the fields work as expected except a radios field, which always shows the default. Here's the relevant code

$one = variable_get('one', array());

$form['one']['visibility'] = array(
 '#type' =&gt; 'radios',
 '#title' =&gt; t('The title'),
 '#options' =&gt; array(0 =&gt; t('Yes'), 1 =&gt; t('No')),
 '#default_value' =&gt; (!empty($one['visibility']))
 ? $one['visibility']
 : 1,
);


I had thought that keying the options array with strings would solve this but it doesn't. I'm still Googling, but I'm wondering if there's something easy I'm missing.
You'll have to refer to the Form API docs for radios for tips.

Second, it might make things easier to reason about if you do:

$one = variable_get('one', array('visibility' =&gt; 0));
$is_visible = $one['visibility'];

$form['one']['visibility'] = array(
 '#type' =&gt; 'radios',
 '#title' =&gt; t('The title'),
 '#options' =&gt; array(0 =&gt; t('Yes'), 1 =&gt; t('No')),
 '#default_value' =&gt; $is_visible,
);