drupal_redirect_form

Versions
5 – 6
drupal_redirect_form($form, $redirect = NULL)
7
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 value containing the destination path to redirect to if none is specified by the form.

Related topics

▾ 9 functions call drupal_redirect_form()

ctools_process_form in contributions/ctools/includes/form.inc
ctools' replacement for drupal_process_form that accepts commands not to redirect, as well as forcing processing of 'get' method forms.
ctools_wizard_multistep_form in contributions/ctools/includes/wizard.inc
Display a multi-step 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.
drupal_process_form_new in contributions/views/includes/form.inc
Views' replacement for drupal_process_form that accepts commands not to redirect, as well as forcing processing of 'get' method forms.
drupal_process_form_new in contributions/views/includes/form.inc
Views' replacement for drupal_process_form that accepts commands not to redirect, as well as forcing processing of 'get' method forms.
openid_authentication in drupal/modules/openid/openid.module
Authenticate a user or attempt registration.
page_manager_page_add_subtask in contributions/ctools/page_manager/plugins/tasks/page.admin.inc
Page callback to add a subtask.
page_manager_page_add_subtask in contributions/ctools/page_manager/plugins/tasks/page.admin.inc
Page callback to add a subtask.
_batch_finished in drupal/includes/batch.inc
End the batch processing: Call the 'finished' callbacks to allow custom handling of results, and resolve page redirection.

Code

drupal/includes/form.inc, line 627

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

Post new comment

The content of this field is kept private and will not be shown publicly.
  • Allowed HTML tags: <a> <em> <strong> <cite> <code> <ul> <ol> <li> <dl> <dt> <dd>
  • Lines and paragraphs break automatically.
  • You may post code using <code>...</code> (generic) or <?php ... ?> (highlighted PHP) tags.
  • Web page addresses and e-mail addresses turn into links automatically.

More information about formatting options

CAPTCHA
This question is for testing whether you are a human visitor and to prevent automated spam submissions.
Image CAPTCHA
Enter the characters shown in the image.