drupal_redirect_form
Definition
drupal_redirect_form($form, $redirect = NULL)
includes/form.inc, line 612
Description
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
| Name | Description |
|---|---|
| Form generation | Functions to enable the processing and display of HTML forms. |
Code
<?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']);
}
}
?> 