chaoticset has asked for the wisdom of the Perl Monks concerning the following question:
Normal carts order things that are constantly renewed; this one orders things that there are limited supplies of, sometimes only one of. However, there are literally going to be *thousands* of cards in the stock.
The behavior of the cart is supposed to be thus:
Click on the 'singles' link. The initial page comes up, with just a search box and a little explanation, which says to put the first few letters of the name of the single you want.
If you don't, it comes back to that page. If you enter at least one letter, it takes a rather large hash, and for *every value with those first few letters*, will print that entry's information.
I did this with this:
Now, the fun part is what it does.$firstfewletters = param("SEARCH"); #a text box elsewhere if ($firstfewletters) { #checks that $firstfewletters has value ***start table here*** foreach $card (@stock) { #for every card in stock... if ($card =~ m/^$firstfewletters/) { # ...if that card's first few letters match # $firstfewletters ***printing each table element here*** } } ***end table here*** } else { print "Please enter the first few letters of the card's name, or ent +er a single letter to view just the cards beginning with that letter in our singles coll +ection."; }
The first time it works; the box, the button, the explanation.
Every time after, it just prints the table with the table header, as if no cards matched.
I thought I'd figured out how to use regexes right, but it appears I'm missing something.
Apologies in advance if this is (stupid|pointless).
Edit kudra, 2001-10-22 Code tags
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: CGI Values, Debugging, And Dynamic Pages
by traveler (Parson) on Oct 22, 2001 at 01:10 UTC |