Perl Programming
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me

The Shed is going Social! Join us on FaceBook and Twitter and chime in on the conversation.

Go Back   Dev Shed ForumsProgramming LanguagesPerl Programming

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
  #1  
Old August 9th, 2000, 10:04 AM
Nam Nam is offline
Junior Member
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Aug 2000
Location: Lanham,MD,US
Posts: 7 Nam User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Send a message via ICQ to Nam
Dear all,

Can you please give me ideas on how to use CGI.pm param() function (or any other ways) to get the text in a TEXTAREA box? I got the value from param() function; however, it ate up the "n", making my text all in one line.

Thank you very much. I really appreciate your help.

Nam.

Reply With Quote
  #2  
Old August 9th, 2000, 12:03 PM
JonLed JonLed is offline
Contributing User
Dev Shed Novice (500 - 999 posts)
 
Join Date: Aug 2000
Location: Indiana
Posts: 614 JonLed User rank is Corporal (100 - 500 Reputation Level)JonLed User rank is Corporal (100 - 500 Reputation Level)JonLed User rank is Corporal (100 - 500 Reputation Level)JonLed User rank is Corporal (100 - 500 Reputation Level) 
Time spent in forums: 4 h 49 m 49 sec
Reputation Power: 14
Foget about CGI.pm.
<BLOCKQUOTE><font size="1" face="Verdana,Arial,Helvetica">code:</font><HR><pre>
####Post Data
read(STDIN, $namevalues, $ENV{'CONTENT_LENGTH'});
@namevalues = split(/&/, $namevalues);
foreach $namevalue (@namevalues) {
($name, $value) = split(/=/, $namevalue);
$name =~ tr/+/ /;
$value =~ tr/+/ /;
$name =~ s/%([a-fA-F0-9][a-fA-F0-9])/pack("C", hex($1))/eg;
$value =~ s/%([a-fA-F0-9][a-fA-F0-9])/pack("C", hex($1))/eg;
$INPUT{$name} = $value;
}
[/code]
That will parse POST data. if you want to turn n's into <br>'s just add these lines above "$INPUT{$name} = $value;":
#####
$value =~ s/n/<br>/g;
$value =~ s/r//g;
#####

[This message has been edited by JonLed (edited August 09, 2000).]

Reply With Quote
  #3  
Old August 9th, 2000, 01:10 PM
freebsd
Guest
Dev Shed Newbie (0 - 499 posts)
 
Posts: n/a  
Time spent in forums:
Reputation Power:
Just be sure NOT to wrap line if the output is to be emailed to you. Do the wrap line otherwise. Also include the following:

$body =~ s/nn/<p>/g;
$body =~ s/n/<br>/g;

Try not to use CGI.pm if possible. I don't even use CGI.pm to upload something from web-based.

[This message has been edited by freebsd (edited August 09, 2000).]

Reply With Quote
  #4  
Old August 9th, 2000, 01:26 PM
Nam Nam is offline
Junior Member
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Aug 2000
Location: Lanham,MD,US
Posts: 7 Nam User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Send a message via ICQ to Nam
Dear freebsd,

I'm a newbie. You mean not to put "WRAP" in the html TEXTAREA box?

I would like to ask you how to upload a file without cgi.pm later when I do it.

Currently I cgi.pm helps me with parsing, cookies, and upload. Can you tell me why we should NOT use CGI.pm?

Thank you very much, freebsd.

Nam.

<BLOCKQUOTE><font size="1" face="Verdana,Arial,Helvetica">quote:</font><HR>Originally posted by freebsd:
Just be sure NOT to wrap line if the output is to be emailed to you. Do the wrap line otherwise. Also include the following:

$body =~ s/nn/<p>/g;
$body =~ s/n/<br>/g;

Try not to use CGI.pm if possible. I don't even use CGI.pm to upload something from web-based.

[This message has been edited by freebsd (edited August 09, 2000).]
[/quote]


Reply With Quote
  #5  
Old August 9th, 2000, 03:45 PM
JonLed JonLed is offline
Contributing User
Dev Shed Novice (500 - 999 posts)
 
Join Date: Aug 2000
Location: Indiana
Posts: 614 JonLed User rank is Corporal (100 - 500 Reputation Level)JonLed User rank is Corporal (100 - 500 Reputation Level)JonLed User rank is Corporal (100 - 500 Reputation Level)JonLed User rank is Corporal (100 - 500 Reputation Level) 
Time spent in forums: 4 h 49 m 49 sec
Reputation Power: 14
<BLOCKQUOTE><font size="1" face="Verdana,Arial,Helvetica">quote:</font><HR>$body =~ s/nn/<p>/g;
$body =~ s/n/<br>/g;[/quote]
I don't like to use <p>'s. That's just me though. (2 <br>'s has the same effect).
<BLOCKQUOTE><font size="1" face="Verdana,Arial,Helvetica">quote:</font><HR>Currently I cgi.pm helps me with parsing, cookies, and upload. Can you tell me why we should NOT use CGI.pm? [/quote]
Because 1) It doesn't let you do what you want to do with the incoming text (or whatever's coming in). 2) Not all server's have it installed. I know most do, but not all. 3) Now YOU have to come here and ask how to do something because you didn't learn it from having to figure out parsing (or at least examine somebody else's code).

It's not like doing things "the old fashion way" is hard. I personally get more satisfaction from figuring out something myself and knowing how it works, rather than just sticking something in and hoping it'll work all the time.

[This message has been edited by JonLed (edited August 09, 2000).]

Reply With Quote
  #6  
Old August 9th, 2000, 04:06 PM
Nam Nam is offline
Junior Member
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Aug 2000
Location: Lanham,MD,US
Posts: 7 Nam User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Send a message via ICQ to Nam
Thank you! Yes, it's time for me to dig into it.

Nam.

Reply With Quote
  #7  
Old August 18th, 2000, 05:21 AM
des des is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: May 2000
Posts: 73 des User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 14
Hi Nam

if you are looking to print the text into a html page and keep it in the format it was typed you could try wrapping it in a pre tag

eg: <PRE>
$your_textarea_variable
</PRE>

Reply With Quote
Reply

Viewing: Dev Shed ForumsProgramming LanguagesPerl Programming > Process value from TEXTAREA. Help Please!!!

Developer Shed Advertisers and Affiliates



Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump

Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 


Powered by: vBulletin Version 3.0.5
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.

© 2003-2013 by Developer Shed. All rights reserved. DS Cluster - Follow our Sitemap