Checked checkboxes after form submit
Most core (and contrib) modules make use of the system_settings_form() function which handily wraps around a form, and saves element values as variables automatically.

function MYMODULE_admin_settings() {
  $types = node_type_get_types();

  $form['content_types'] = array(
    '#type' =&gt; 'fieldset',
    '#title' =&gt; t('Content types'),
    '#description' =&gt; t('test'),
    '#collapsible' =&gt; TRUE,
    '#collapsed' =&gt; TRUE,
  );
  foreach ($types as $typename =&gt; $type) {
    $form['content_types']["MYMODULE_settings_$typename"] = array(
        '#type' =&gt; 'checkbox',
        '#title' =&gt; $type-&gt;name,,
        '#default_value' =&gt; variable_get("MYMODULE_settings_$typename", 0)
    );
  }
  $form['submit'] = array(
      '#type' =&gt; 'submit',
      '#value' =&gt; t('Submit'),
  );

  return system_settings_form($form);

}


You can then grab the value anywhere else in code like this (using the 'page' content type as an example):

$val = variable_get('MYMODULE_settings_page');


Which is a bit counter-intuitive. You might want to make use of a checkboxes type instead, e.g.

$options = array();
foreach ($types as $typename =&gt; $type) {
  $options[$typename] = $type-&gt;name;
}
$form['content_types']['MYMODULE_content_types'] = array(
  '#type' =&gt; 'checkboxes',
  '#title' =&gt; $type-&gt;name,
  '#options' =&gt; $options,
  '#default_value' =&gt; variable_get('MYMODULE_content_types', array())
);


Then you can get an array of all selected content types like this:

$selected_types = array_filter(variable_get('MYMODULE_content_types', array()));