function drupal_redirect_form

7.x form.inc drupal_redirect_form($form_state)
5.x form.inc drupal_redirect_form($form, $redirect = NULL)
6.x form.inc drupal_redirect_form($form, $redirect = NULL)
8.x form.inc drupal_redirect_form($form_state)

Redirect the user to a URL after a form has been processed.

Parameters

$form: An associative array containing the structure of the form.

$redirect: An optional string containing the destination path to redirect to if none is specified by the form.

Related topics

1 call to drupal_redirect_form()
drupal_process_form in drupal/includes/form.inc
This function is the heart of form API. The form gets built, validated and in appropriate cases, submitted.

File

drupal/includes/form.inc, line 491

Code

function drupal_redirect_form($form, $redirect = NULL) {
  if (isset($redirect)) {
    $goto = $redirect;
  }
  if (isset($form['#redirect'])) {
    $goto = $form['#redirect'];
  }
  if ($goto !== FALSE) {
    if (is_array($goto)) {
      call_user_func_array('drupal_goto', $goto);
    }
    elseif (!isset($goto)) {
      drupal_goto($_GET['q']);
    }
    else {
      drupal_goto($goto);
    }
  }
}