Form state redirect to previous page 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;
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.