How do I redirect a form after has been submitted? I need to upgrade this Drupal 6 code to Drupal 7.

I add a form submission handler to a form, using an implementation of hook_form_alter() that executes the following code.

array_unshift($form['buttons']['submit']['#submit'], 'MODULE_case_form_pre_submit');
$form['buttons']['submit']['#submit'][] = 'MODULE_case_form_submit';


The code for MODULE_case_form_submit() is the following.

function MODULE_case_form_submit($form, &amp;$form_state) {
  if ($form_state['values']['type'] == 'case_slide') {
    $form_state['redirect'] = 'case/' . $form_state['values']['cid'];
    return;
  }
}
There isn't anything different between Drupal 6, and Drupal 7, for the code you are showing, which means:


$form_state['values'] still contains the values submitted from the users
$form_state['redirect'] is still used to redirect the users to a different page


What changes is that the submission buttons for the node edit form are inside $form['actions']. 

  // Add the buttons.
  $form['actions'] = array('#type' =&gt; 'actions');
  $form['actions']['submit'] = array(
    '#type' =&gt; 'submit', 
    '#access' =&gt; variable_get('node_preview_' . $node-&gt;type, DRUPAL_OPTIONAL) != DRUPAL_REQUIRED || (!form_get_errors() &amp;&amp; isset($form_state['node_preview'])), 
    '#value' =&gt; t('Save'), 
    '#weight' =&gt; 5, 
    '#submit' =&gt; array('node_form_submit'),
  );
  $form['actions']['preview'] = array(
    '#access' =&gt; variable_get('node_preview_' . $node-&gt;type, DRUPAL_OPTIONAL) != DRUPAL_DISABLED, 
    '#type' =&gt; 'submit', 
    '#value' =&gt; t('Preview'), 
    '#weight' =&gt; 10, 
    '#submit' =&gt; array('node_form_build_preview'),
  );
  if (!empty($node-&gt;nid) &amp;&amp; node_access('delete', $node)) {
    $form['actions']['delete'] = array(
      '#type' =&gt; 'submit', 
      '#value' =&gt; t('Delete'), 
      '#weight' =&gt; 15, 
      '#submit' =&gt; array('node_form_delete_submit'),
    );
  }