Howdy all you high priests!
Anyway, I have been working on a simple CGI perl script so i can leanr how to code - wow, what deep meditation it requires!
So, I want to trap anything less than 1 and more than 6000555. At the same time, I also do not want any special characters. So, any number from 1 to the 6000555 is great.
So, for the user to see the errors of his ways, it must be printed. So, here are my two problems:
1. How do I get it to go to a frame called "stuff" in a framed website?
2. Here is my code (I know what you all are thinking, but I am a newlie and this is my first attempt). The input is called $patent. What was happening at first is that it would print the error message, but over and over and over. Then I made some changes and now it just spins off into space and the page never loads, just acts like it will. By the way, if I enter a correct nymber, it all works great and the html code at the end prints what I want.
$patent =$value;
while (1) {
# checking for any non-numeric characters
unless ($patent =~ /^[\d]+$/){
print <<ENDERRORCARD;
<HTML>
<HEAD>
<TITLE>Data Entry Error</TITLE>
</HEAD>
<BODY TEXT="#000000" BGCOLOR="#FFFFFF" LINK="#0000EE" VLINK="#551A
+8B"
ALINK="#FF0000">
<CENTER>
You either entered a patent number with special characters.<BR>
Use your browser's BACK option to try again.
</CENTER><P>
</BODY>
</HTML>
ENDERRORCARD
next;
}
last if 1 <= $patent and $patent <= 6009555;
print <<ENDERRCARD;
<HTML>
<HEAD>
<TITLE>Data Entry Error</TITLE>
</HEAD>
<BODY TEXT="#000000" BGCOLOR="#FFFFFF" LINK="#0000EE" VLINK="#551A
+8B"
ALINK="#FF0000">
<CENTER>
You entered a patent number that was not between 1 and 6,009,555.<
+P>
Use your browser's BACK option to try again.
</CENTER><P>
</BODY>
</HTML>
ENDERRCARD
}
# This compares the patent number of the user against US patent number
+ dates
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.