So, I'm passing data from a form to a script to insert data into a database. Simple, yes, and I feel really stupid for having problems with this.. I'm using someone else's script (because I was instructed to, and because its supposed to "Work"). well, it doesn't.
when you pass it the input from a checkbox, it only inserts the first element of the checkbox array into the database.. so I tried a few things.. one (the commented one) didn't work, and while the other doesn't error, it doesn't do what I wanted it to do.. I'd like to make this as dynamic as possible, that way, it doesn't matter what variable becomes a check box or multi-select in the future, it'll still work.
here's what I have.. %INPUT is formed using the old fashioned
if ($ENV{'REQUEST_METHOD'} eq 'POST') read(STDIN, $buffer, $ENV{'CONTE
+NT_LENGTH'});
why, I don't know, but I "should use this because its more portable".
anyways here's the part that needs attention:
foreach $thing (keys(%INPUT)) {
if(ref($INPUT{$thing}) eq "ARRAY") { $INPUT{$thing} = join('^'
+, $$INPUT{$thing}); }
# if($#INPUT{$thing}) { $INPUT{$thing} = join('^', $$INPUT{$thin
+g}); }
}
any other ideas? or insight?
-brad.. tired, bored, and tired. :)
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.