Fw: [thelist] Formatting text fields
Matthew Fischer
mfischer at e-fishsolutions.com
Tue Feb 6 06:32:37 CST 2001
On 2/6/01 at 8:44 PM, adrian at logo-logic.com (Adrian Fischer) wrote:
> > I take it you would only see the results from this when you retrieve it
> from
> > the db or file were it is saved to? I was hoping to be able to display
> the
> > formatted text on a preview screen before saving to file. This doesnt
> seem
> > to be able to be done
> >
Sure it does, look at http://www.e-fishsolutions.com/test.html
Here's the script it's using:
#!/usr/bin/perl
#
##########################################################
# Parse form data
read(STDIN, $buffer, $ENV{'CONTENT_LENGTH'});
if (length($buffer) < 5) {
$buffer = $ENV{QUERY_STRING};
}
@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;
}
# Add <P>'s and <BR>'s
$form{'PARA2'}=~s/\r\n\cM\n/<P>/g;
$form{'PARA2'}=~s/\r\n/<BR>/g;
# Print Results to Screen
print "Content-type: text/html\n\n";
print "<HTML><HEAD></HEAD><BODY>";
print "$form{'PARA2'}";
print "</BODY></HTML>";
##########################################################
More information about the thelist
mailing list