Prev: Are there any good tutorials for writing perl cell phone programs?
Next: FAQ 7.19 What's the difference between deep and shallow binding?
From: Patrick Hartman on 29 Mar 2010 15:13 Hi, I am creating a login form that redirects the user to a different page after they are authenticated. It is redirecting them, always opens up the new page in a seperate browser window/tab and leaves the login form open. I was hoping to have it perform the redirect in the same browser window that they are using to login. Is this possible? #!/usr/bin/perl -w use strict; use CGI; # make cgi object my $cgi = CGI->new; # if the page was posted if ($ENV{'REQUEST_METHOD'} eq 'POST') { # form data we will authenticate my ($username,$password) = ($cgi->param('username'),$cgi- >param('password')); # ... do that ... # redirect them where they need to go print $cgi->redirect(-uri => 'http://localhost/stats/sales- comparison', -status => 301); } I also tried doing it without CGI by just sending a location header, but that did the same thing: #!/usr/bin/perl -w use strict; # if the page was posted if ($ENV{'REQUEST_METHOD'} eq 'POST') { # form data we will authenticate my ($username,$password) = ($cgi->param('username'),$cgi- >param('password')); # ... do that ... # redirect them where they need to go print "Location: http://localhost/stats/sales-comparison\n\n"; } Any suggestions or tips would be appreciated. Patrick
From: Patrick Hartman on 29 Mar 2010 17:37
Please disregard, the problem was due to a typo in my HTML form code. Sorry about that. Patrick |