[thelist] Re: Formatting textarea

Adrian Fischer adrian at logo-logic.com
Mon Feb 19 14:46:27 CST 2001


Hi Katherine,

It must be me.....it still doesnt format the text.  Perhaps I ve got it in
the wrong place.  The actual textarea is in a different sub to the one Im
doing (trying) the formatting in.  The texatarea string gets to the new sub
but unformatted.  Could it be that my form data processing routine isnt
structured right?
Perhaps an expert out there would look at this and tell me?  Perhaps this
sub is stripping all the returns and what not out already so that by the
time it gets to my formatting code there is nothing to act upon...makes
sense doesnt it?

<snip>
####FORM DATA
sub get_form_data {
        my $temp;
        my $buffer;
        my @data;
        read(STDIN, $buffer, $ENV{'CONTENT_LENGTH'});
        foreach $temp (split(/&|=/,$buffer)) {
                $temp =~ tr/+/ /;
                $temp =~ s/%([0-9a-fA-F]{2})/pack("c",hex($1))/ge;
  $temp =~ s/[\r\n]/ /g;
                push @data, $temp;
        }
        foreach $temp (split(/&|=/,$ENV{'QUERY_STRING'})) {
                $temp =~ tr/+/ /;
                $temp =~ s/%([0-9a-fA-F]{2})/pack("c",hex($1))/ge;
  $temp =~ s/[\r\n]/ /g;
                push @data, $temp;
        }
        return @data;
}
</snip>

Thanks Again

Adirna Fischer

Katherine wrote:
>
> \n = perl new line
> \r = carriage return (which is what you are searching for :-), so
>
> $form{'yourad'}=~ s/\r/<BR>/g;
>
> will work, but you need to include the s operator, to treat the string
> as single line, so what you want is
>
> $form{'yourad'}=~ s/\r\r/<P>/gs;
> $form{'yourad'}=~ s/\r/<BR>/gs;
> 
> HTH,
>
> Katherine






More information about the thelist mailing list