edahm has asked for the wisdom of the Perl Monks concerning the following question:
However, I'm having trouble when the user doesn't fill out all the fields. Then in the email to the administrator:if ($ENV{'REQUEST_METHOD'} eq 'POST') { read(STDIN, $buffer, $ENV{'CONTENT_LENGTH'}); @pairs = split(/&/, $buffer); foreach $pair (@pairs) { ($name, $value) = split(/=/, $pair); $value =~ tr/+/ /; $value =~ s/%([a-fA-F0-9][a-fA-F0-9])/pack("C", hex($1))/eg; $FORM{$name} = $value; }
It does not put in the new lines if the user did not fill in a particular field. A new line is only created if there was something entered. My guess is that I need to check for the null (undef??) fields when I un-webby-fy and put a new line "\n" in it instead of leaving it blank. However, my limited perl knowledge keeps me from doing so. Thank you thank you thank you for your help/advice. It would be great if you could e-mail any replies to me as well at elizabeth.dahm@hope.eduopen (MESSAGE,"| /usr/lib/sendmail -t"); print MESSAGE "To: $FORM{submitaddress}\n"; print MESSAGE "From: $FORM{name}\n"; print MESSAGE "Reply-To: $FORM{email}\n"; print MESSAGE "Subject: Faculty Bibliography Submission\n\n"; print MESSAGE "The following information was submitted from $FORM{ +name} at $FORM{email}:\n\n"; print MESSAGE "Full Name: $FORM{name}"; print MESSAGE "\n"; print MESSAGE "Publication Name: $FORM{pubname}"; print MESSAGE "\n"; print MESSAGE "Other Authors: $FORM{otherauthors}"; print MESSAGE "\n"; print MESSAGE "Other Editors: $FORM{othereditors}"; print MESSAGE "\n"; print MESSAGE "Main Publication Title: $FORM{pubtitle}"; print MESSAGE "\n"; . . . . close (MESSAGE);
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: checking for null variables
by hardburn (Abbot) on Apr 15, 2003 at 18:29 UTC | |
by merlyn (Sage) on Apr 15, 2003 at 18:34 UTC | |
|
Re: checking for null variables
by crouchingpenguin (Priest) on Apr 15, 2003 at 18:41 UTC | |
by merlyn (Sage) on Apr 15, 2003 at 19:45 UTC | |
by edahm (Initiate) on Apr 16, 2003 at 20:02 UTC | |
by merlyn (Sage) on Apr 16, 2003 at 20:08 UTC | |
by VSarkiss (Monsignor) on Apr 15, 2003 at 19:12 UTC | |
|
Re: checking for null variables
by Improv (Pilgrim) on Apr 15, 2003 at 19:17 UTC | |
by dragonchild (Archbishop) on Apr 15, 2003 at 19:59 UTC |