One of your problems comes from the fact that you're printing the header at the top of your script, before your redirect logic.
#!c:\phpdev\perl\bin\perl.exe
print "Content-type: text/html\n\n";
# -----8<-----
The print line in this block interferes with the redirect statements later in the code. Move your print line from this block to your HTML print block, like so:
# -----8<-----
else {
print "Content-type: text/html\n\n"; # Line moved here.
print "<HTML>\n";
print "<HEAD><TITLE>Patton Industries</TITLE><BASEFONT SIZE=5></HEAD>\
+n";
# -----8<-----
In fact, you're printing these headers manually when you should be using CGI.pm. Doing so is simple enough, try this:
my $cgi = new CGI(); # Declare this near the top of the script.
print $cgi->header(); # In place of your "Print: content-type..."
+statement.
A similar convention exists for your redirect statements. Be sure to review the CGI.pm documentation. It will simplify things for you, even if it looks more complicated now.
A few other suggestions/concerns:
- What happens when $Salesperson eq "", $Sales == "", and $Rate == "" at the same time?
- Look into HERE documents. They'll save you a lot of trouble retyping 'print' over and over at the end of your script. :)
- Read up on CGI.pm. It will save you a lot of typing and tracking with respect to the HTML tags. To do so, open a DOS prompt and type "perldoc CGI.pm", without the quotes, on the command line.
Hope this helps.
/Larry
Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
Read Where should I post X? if you're not absolutely sure you're posting in the right place.
Please read these before you post! —
Posts may use any of the Perl Monks Approved HTML tags:
- a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
| |
For: |
|
Use: |
| & | | & |
| < | | < |
| > | | > |
| [ | | [ |
| ] | | ] |
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.