Redirecting the user to the previous page using CGI.pm should be failry straightforward. Here's some sample code that should give you an idea on how to go about this.
#!/usr/bin/perl
use strict;
use CGI;
my $query = CGI->new();
# code to enter records into database goes here.
my $referrer = $ENV{HTTP_REFERER};
print $query->redirect($referrer);
Hope this helps.
- wil | [reply] [d/l] |
There's a referer() subroutine for clarity:
use CGI qw(redirect referer);
print redirect(referer());
-- Randal L. Schwartz, Perl hacker | [reply] [d/l] |
print header(-location=>'name.html');
After you update your databas
Thanks.
Hotshot | [reply] [d/l] |
At the appropriate point in your CGI have a print qq(<meta HTTP-EQUIV="REFRESH" URL="someurl" CONTENT="0"/>); That is how you would do it if you aren't using CGI.pm which you should be actually. Using CGI.pm you would do this: print $query->redirect(-uri=>'http://somewhere.else/in/movie/land',
-nph=>1);
I just thought you might like to see both ways to get a better idea of what you are working with. Bottom line is that you should use CGI.pm.
| [reply] [d/l] [select] |
print "Location:name.html\n\n";
Chris
Some clever or funny quote here. | [reply] [d/l] |
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
| [reply] |