in reply to how do I redirect to a previous page in my CGI script

Printing the header yourself also works:

print "Location:name.html\n\n";

Chris

Some clever or funny quote here.

Replies are listed 'Best First'.
•Re: Re: how do I redirect to a previous page in my CGI script
by merlyn (Sage) on May 14, 2002 at 14:54 UTC
    Officially, the Location header is like all other headers, and requires a space after the colon. If it happens to work without that for a particular setup, the setup is error correcting your mistake, and you'll be burned the day you move to a setup that doesn't do such error correction.

    Also, you should be aware of the difference between a CGI script issuing an internal redirect versus an external redirect. Without a HTTP scheme (as in your example), an internal redirect will change the served page, but not the browser's idea of the served page. This has implications with regard to error messages and relative URLs. More often, what you want is an external redirect, which causes the browser to refetch the page at the new address.

    -- Randal L. Schwartz, Perl hacker