|
I'm trying to redirect a perl script to an html but I dont know what Im doing wrong. The page is telling me Internet Explorer cannot display the webpage and in the address bar its showing the c12ex3.cgi instead of c12ex3b.html page. FYI:The question was purposely put in.
<!c12ex3a.html> <HTML> <HEAD><TITLE>Patton Industries</TITLE></HEAD> <BODY BGCOLOR=#FFFFCC> <H2>Bonus Calculator</H2> <TABLE> <TR> <TD>Salesperson name:</TD> <TD><INPUT NAME=Salesperson SIZE=30></TD></TR> <TR> <TD>Sales amount:</TD> <TD><INPUT NAME=Sales SIZE=10></TD></TR> <TR> <TD>Bonus rate:</TD> <TD><INPUT NAME=Rate SIZE=10></TD></TR> </TABLE> <P><INPUT TYPE=submit VALUE=Submit> <INPUT TYPE=reset></P> </BODY> </HTML>
#!usr/bin/perl #c12ex3.cgi - calculates a bonus amount and creates a dynamic Web page #that contains form data and a bonus amount use CGI qw(:standard);
#prevent Perl from creating undeclared variables use strict; #declare variables my ($name, $sales, $rate, $bonus);
#assign values to variables $name = param('Salesperson'); $sales = param('Sales'); $rate = param('Rate');
#remove leading and trailing spaces from name $name =~ s/^ +//; $name =~ s/ +$//;
#remove leading and trailing spaces from sales $sales =~ s/^ +//; $sales =~ s/ +$//;
#remove leading and trailing spaces from rate $rate =~ s/^ +//; $rate =~ s/ +$//;
#calculate bonus amount $bonus = $sales * $rate;
#create Web page if ($name ne "" or $sales ne "" or $rate ne "") { print "Content-type: text/html\n\n"; print "<HTML>\n"; print "<HEAD><TITLE>Patton Industries</TITLE><BASEFONT SIZE=5></HEAD>\n"; print "<H1>Bonus Calculation</H1>\n"; print "<BODY>\n"; print "Salesperson: $name<br>\n"; printf "Your bonus is \$%.2f.<br><br>\n", $bonus; printf "You entered a sales amount of \$%.2f and a \n", $sales; printf "bonus rate of %.1f%%.<br>\n", $rate * 100; print "</BODY>\n"; print "</HTML>\n"; } else { print "Location: http://?.netfirms.com/c12ex3b.html\n\n"; }
<!c12ex3b.html> <HTML> <HEAD><TITLE>Patton Industries</TITLE></HEAD> <BODY> <H2>Please press your browser's Back button to return to the form. Then complete all items.</H2> </BODY></HTML>
|