in reply to Simple question about CGI/Perl and html redirection

I'm not sure exactly what you're asking. To issue a redirect, you can send the Location header, as in

print "Location:$url\n\n"; #which is wrong, see below.

Which must be issued BEFORE you send any output to the browser. Alternately, you can use CGI.pm's redirect function:

print CGI::redirect($url);

I'd use the CGI param function to get data from forms, though.

Note: neither of these will 'send along' your POSTed data to the following URL.

Philosophy can be made out of anything. Or less -- Jerry A. Fodor

Replies are listed 'Best First'.
Re: Re: Simple question about CGI/Perl and html redirection
by merlyn (Sage) on Mar 27, 2001 at 21:21 UTC
    print "Location:$url\n\n";
    By standards, there must be a space after the colon. If you fail to do that, the server or browser must error-correct your code, and that may not always happen consistently.

    -- Randal L. Schwartz, Perl hacker

      Sigh. yep. Not having to remember little things like that is a good argument for using CGI::redirect($url), IMO.

      Philosophy can be made out of anything. Or less -- Jerry A. Fodor