/** * Redirect the user to a URL after a form has been processed. * * @param $form * An associative array containing the structure of the form. * @param $redirect * An optional string containing the destination path to redirect * to if none is specified by the form. * */function drupal_redirect_form($form, $redirect = NULL) { if (isset($redirect)) { $goto = $redirect; } if (isset($form['#redirect'])) { $goto = $form['#redirect']; } drupal_redirect($goto);}/** * Generates a drupal_goto() based on the value of $goto. * * @param $goto * Can be any of the following values: * -- A string representing a valid Drupal path. * -- An array containing arguments to pass to drupal_goto(). * -- NULL to redirect to $_GET['q']. * -- FALSE to bypass the redirection. */function drupal_redirect($goto) { 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']); }}