in reply to Perl/CGI redirect.
You shouldn't print the Content-Type header if you are going to redirect. It should be one or the other, so:
The logic could as easily be done in an if(){}else{} type construct, but I like the directness of this way. I omitted definedness checking on param('Password'), but you might want to add it in.use CGI qw( :standard ); use CGI::Carp qw( fatalsToBrowser ); print redirect("/login.html") and exit 0 unless defined param("Name"); my $Name = param("Name"); my $Password = param("Password"); print header; # CGI.pm method # print "Content-type: text/html\n\n";
Update: You also need to print the redirect, corrected in code.
After Compline,
Zaxo
|
|---|