CGI/Perl Guide | Learning Center | Forums | Advertise | Login
Site Search: in

  Main Index MAIN
INDEX
Search Posts SEARCH
POSTS
Who's Online WHO'S
ONLINE
Log in LOG
IN

Home: Perl Programming Help: Intermediate:
Stop Lines in Textarea

 



andy7t
User

Sep 16, 2003, 11:02 AM

Post #1 of 2 (470 views)
Stop Lines in Textarea Can't Post

Hello,

I'm using this code:

<form action=?do method=post>
<textarea name=input>

</textarea>



sub do
{

open F, ">data/file.txt";

#also tried chomp $in{'input'}

print F "$in{'input'}"; #also used \n";

close F;
}



However, when i open up file.txt i see:



An input



with 2 lines



instead of just



one



Like that.

I can't work out how to put in just one space.

Thanks


KevinR
Veteran


Sep 16, 2003, 12:45 PM

Post #2 of 2 (466 views)
Re: [andy7t] Stop Lines in Textarea [In reply to] Can't Post

this may very from browser to browser, but give this a try:

<textarea name="input" wrap="soft">

if that does not work then you may need to parse out the linefeeds/carraige returns sent with the textarea form submission, something like:


Code
   

if ($in{
'input'}) {
$in{
'input'} =~ s/\r\n//g;
$in{
'input'} =~ s/\n//g;
}





or you can do both. Make sure to add a newline to the end of the string in your print statement if you parse out \r\n's from the form data.
-------------------------------------------------


(This post was edited by KevinR on Sep 16, 2003, 12:47 PM)

 
 


Search for (options) Powered by Gossamer Forum v.1.2.0

Web Applications & Managed Hosting Powered by Gossamer Threads
Visit our Mailing List Archives