Take the 2-minute tour ×
Drupal Answers is a question and answer site for Drupal developers and administrators. It's 100% free, no registration required.

I have a custom form which can be accessed from different places inside the website. The form itself is inside the admin overlay.
When the form is submitted, I want the user (administrator) to return to the place where he accessed the form. The form can also be accessed from within the overlay.
Inside the submit handler I use a form redirect to return but I don't have a clue how to determine the url of the previous page to return to.

// $_SERVER['REDIRECT_URL']? 
$redirect = 'set redirect url'
$form_state['redirect'] = $redirect;
share|improve this question
add comment

1 Answer

If I'm not wrong by default the form redirect the user in the page where it was generate. But, if you want change it you can use the function drupal_get_destination and add it to your action="" simply by changing the $form['#action'] in your code.

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.