in reply to Re: redirect back to where you were
in thread redirect back to where you were

You can jump back two pages if you dynamically generate the form from a cgi script. What I do is leave the electronic equivalent of bread crumbs.

I put $ENV{'HTTP_REFERER'} into a hidden form field inside my dynamically generated form.

<form> --------- stuff ---- <input type="hidden" name="backpage" value="$ENV{'HTTP_REFERER'}"> <input type="submit"> </form>
Now you are free to redirect them in the final, form processing, script to CGI::redirect($input{'backpage'}).

(Actually, I'm not so sure what CGI.pm puts it's input into, because I don't use it. But you get my meaning.)

oakbox
"If what I'm saying doesn't make sense, that's because sense cannot be made, it's something that must be sensed"-J.S. Hall

Replies are listed 'Best First'.
(pmas) Re: redirect back to where you were
by pmas (Hermit) on Jul 25, 2001 at 17:30 UTC
    I knew about JavaScript trick, but I like more trick with using $ENV{'HTTP_REFERER'} and will use it in my current project. Why? It works also if client disabled JavaScript (as I did recently).
    Quite often I'll also just add plain link (or submit button) like {Back to Main Menu} or {Close All Open Issues}, just to bypass multiple {BACK} commands and start fresh. Sometimes it's easier for users to start afresh.

    pmas
    To make errors is human. But to make million errors per second, you need a computer.