Craig,

"..is outputting the string without the carriage returns so all lines run 
together on the html
page..."

are you sure that the carriage returns are not being shown??

i would suggest you look a the HTML source of the page and you might see the 
carriage returns being displayed.

its just that the broser would ignore carriage returns while showing the 
actual content.

if you want to confirm that, there are 2 ways.

1) enclose that variable in <pre></pre> tags so that the carriage returns 
are now displayed properly.

2) replace all occurences of the carriage return with the <BR> HTML tag, as 
follows....


$postInputs{'procedure_field'}=~ s/\r\n/<br>/g;

## OR
$postInputs{'procedure_field'}=~ s/\n$/<br>/g;


Hope that helps.

Let me know how it goes
>
>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
>
><< CraigSharp.vcf >>

_________________________________________________________________
Get your FREE download of MSN Explorer at http://explorer.msn.com

_______________________________________________
Perl-Unix-Users mailing list. To unsubscribe go to 
http://listserv.ActiveState.com/mailman/subscribe/perl-unix-users

Reply via email to