Problem with form submit handler using system_settings_form for module admin I have a module which creates an admin backend.  I create the form as below.  The submit handler is called, but for some reason there is no form state.

Any idea what's wrong please?

     //in hook menu
    'page arguments' =&gt; array('carousel_form'),

    function carousel_form($form, &amp;$form_state) {
       $form = array();

      /* first fieldset */
      $form['fieldset_1'] = array(
      '#type' =&gt; 'fieldset',
      '#title' =&gt; t('Carousel slide 1'),
      '#description' =&gt; t('Configure the first slide of the carousel here'),
      '#required' =&gt; TRUE,
      '#collapsible' =&gt; TRUE,
      '#collapsed' =&gt; FALSE,
       );
       //more fields etc etc          

      $form['#submit'][] = 'my_custom_handler';

      return system_settings_form($form);
      }

      //create a handler 

      function my_custom_handler($form, &amp;$form_state) {
      $file = file_load($form_state['fieldset_1']['pic_1']);
      //causes error, Undefined index: fieldset_1 


      }
Not quite...$form_state is defined (or at least will be if you have a standard installation of Drupal).

The problem is the submitted values are in $form_state['values'], not $form_state. Also, Unless you have #tree set to TRUE on $form['fieldset_1'] the values will be collapsed, and the hierarchy you're expecting won't be there.

This should work:

$file = file_load($form_state['values']['pic_1']);