hi Folks,
I have built a form that dumps everything into a flatfile. I'm trying to clean things up a bit and use better practices.
My problem stems from when I have empty fields (for example checkboxes that are left un-checked etc), they are not being added to the flatfile as a "blank" tab. Can anyone see where I'm going wrong here? Is it the sort that's kicking out my "null" values?
sub makelog {
open (LOGFILE, ">>$logfile") or die("Can't Open Log File at $l
+ogfile");
@FieldNames = sort (keys %FORM);
foreach $key (@FieldNames) {
print LOGFILE ("\t"."$FORM{$key}");
}
print LOGFILE ("\n");
close (LOGFILE);
}
From a rusty perl novice, Thanks!
LakeTrout
Update: It appears that if I add a new line in a text area,things start to go wrong from there. I added this to my split function:
$value =~ s/%0D%0A/\, /g;
that didn't seem to help either. Here's a snippet:
@pairs = split(/&/, $buffer);
foreach $pair (@pairs) {
($name, $value) = split(/=/, $pair);
$value =~ s/%0D%0A/\, /g;
...
}
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.