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);
In reply to checking for null variables by edahm
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |