I got lucky. (There are those who believe luck is just the intersection of patience and preparation; who am I to argue with them?)
Some things can only be so f*cked up and do what they're supposed to do.
I was going to attempt an analogy, but it's better to explain. (Especially for myself.)
I had this problem: How do I make a subroutine stop iterating across a list of checkbox values once it's reached the end? As far as I can tell, if there's a checkbox that's not checked, it doesn't return anything that I could look for to indicate that the list is still going but not checked at that point.
I had some funky-ass nested IF and UNTIL statements, trying to check for the existence of something and then for a slapdash 'ending value' I was artificially inserting into each page. I had noted (rightfully!) that I would have to fix it someday, because it was sloppy, but hadn't changed it because there was no better alternative coming to mind.
"Gee," I mused, "wouldn't it be ultra-helpful if I had that checkbox info in a hash, so I could just check keys and all that?" I nodded to myself.
"But how would I fill a hash with the info? What would I set value names to?" Blah, blah, etc., etc., and then something odd occurred to me: I'm *counting* how many times there's a checkbox dumped onto the previous page.
Why not store that in a hidden value?
If it works like I think it will, this will fix the last problem with the cart checker *and* allow me to move up to my security issues, which definately need dealing with.
I got lucky on this one because I was moments away from deciding that I wasn't getting any work done and, therefore, should just go to bed. (I probably should anyway, but the hell with it. I believe it was Erdos who always said that 'there will be time to rest in the grave'.)
I'm going to be so glad to be done with this thing. I honestly found it hard to believe I've been doing this thing for over three months now. It will feel like a little slice of heaven to watch this thing operate; it will make me smile all the time for a week; it will make me want to kiss people.
For now...it just makes me want to be done.
Of course, if you give the same name to all of the checkboxes in a group, you can call CGI::param() with the name and assign the results to an array. That'll give you all the values.
Iterating over an array is easy.