| 5 form.inc | drupal_redirect_form($form, $redirect = NULL) |
| 6 form.inc | drupal_redirect_form( |
| 7 form.inc | drupal_redirect_form($form_state) |
| 8 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 value containing the destination path to redirect to if none is specified by the form.
Related topics
3 calls to drupal_redirect_form()
File
- includes/
form.inc, line 634
Code
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']);
}
}
Login or register to post comments
Comments
form_state[redirect]
Very important & handy (to me) detail:
$form_state['redirect']works in D6 as well as D7. Only it's not documented (?) for D6.The syntax is slightly different though. From the D7 example (on http://api.drupal.org/api/drupal/includes--form.inc/function/drupal_redi...):
$form_state['redirect'] = array('node/123', // uri
array( // query params
'foo' => 'bar',
),
);
I don't know about the
fragment...