Hello,
I am using a form on my website for procedure submission. The form has several input
boxes for the user to enter information. The actual procedure input box may have
several lines that contain carriage returns. As an example, a numbered list of steps
to follow.
I am using the post method to send the data to my perl script. Within the script, I
am decoding the data with the following routine:
sub readPostInput(){
my (%searchField, $buffer, $pair, @pairs);
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;
$name =~ tr/+/ /;
$name =~ s/%([a-fA-F0-9][a-fA-F0-9])/pack("C", hex($1))/eg;
$searchField{$name} = $value;
}
}
return (%searchField);
}
Following the decoding, I am writing the procedure out to a file as html for review
and placement on the corporate intranet:
sub fileStorage(){
open (OUTFILE,
">apps:/intranet/IRIS/Admin/NetAdmin/Procedures/review_storage/$postInputs{'fn_store'}");
select (OUTFILE);
print << "EOF";
<html><head><title>Procedure: $postInputs{'title_field'}</title></head>
<body bgcolor=#ffffff>
<h1><center>$postInputs{'title_field'}</center></h1></td><br>
Created by: <em>$postInputs{'select_author'}</em><br>
Date Created: <em>$postInputs{'date_field'}</em><br>
Procedure Category: <em>$postInputs{'select_category'}</em>
<h2>Procedure Introduction</h2>
<p>$postInputs{'intro_field'}</p>
<h2>Procedure Description</h2>
$postInputs{'procedure_field'}<br>
</body>
</html>
EOF
close (OUTFILE);
select (STDOUT);
}
Herein lies the problem, the last line of field output:
$postInputs{'procedure_field'}<br>
is outputting the string without the carriage returns so all lines run together on the
html page.
I need to have the information formatted as the user had intended with the carriage
returns in the correct place.
I would greatly appreciate any insite into solving this problem.
Thanks for your time,
Craig A. Sharp
Unix System Administrator
DNS Administrator
Roush Industries
734-779-7282
BEGIN:VCARD
VERSION:2.1
X-GWTYPE:USER
FN:Craig Sharp
ORG:;It support
EMAIL;WORK;PREF:[EMAIL PROTECTED]
N:Sharp;Craig
X-GWUSERID:Cashar
END:VCARD