#!c:\phpdev\perl\bin\perl.exe #c12ex3.cgi - Location Header print "Content-type: text/html\n\n"; use CGI qw(:standard -debug); #prevent Perl from creating undeclared variables use strict; #declare variables my ($Salesperson, $Sales, $Size, $Rate, $Percentage, @records, @errors +, $errors, $bonus); #assign input items to variables $Salesperson = param('Salesperson'); $Sales = param('Sales'); $Rate = param('Rate'); $Percentage = param('Percentage'); #calculate bonus rates $bonus = $Rate * $Sales; if ($Salesperson eq "") { print "Location: http://localhost/cgi-bin/c12ex3b.html\n\n"; } elsif ($Sales == "") { print "Location: http://localhost/cgi-bin/c12ex3b.html\n\n"; } elsif ($Rate == "") { print "Location: http://localhost/cgi-bin/c12ex3b.html\n\n"; } else { 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: $Salesperson<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"; print "</BODY></HTML>\n"; }
In reply to Re^2: HTTP headers and redirection
by student
in thread HTTP headers and redirection
by student
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |