Milti has asked for the wisdom of the Perl Monks concerning the following question:
I want to retrieve and print the contents of a Text Area exactly as it was input from a keyboard, i.e. with no HTML formatting. I am using the code noted below. The content is retrieved and printed but as a single line when it was entered as multiple paragraphs. This is the code I am using
use strict; use warnings; use CGI; my $q = CGI->new; # Print the HTTP header print $q->header; # Get the content of the text area. # Replace 'textarea_name' with the actual 'name' attribute of your HTM +L textarea. my $textarea_content = $q->param('message'); # Print the content exactly as received ####print "Content of the text area:\n"; print $textarea_content;
When content is entered as HTML it is returned as originally entered. Otherwise the return is one line. Is there a way to solve my problem? Thanks for any and all help!
|
---|
Replies are listed 'Best First'. | |
---|---|
Re: Retrieve and Print TextArea Content
by Corion (Patriarch) on Sep 12, 2025 at 18:23 UTC |