|
|
|||||||||
|
|||||||||
| |||||||||
|
|
|
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
|
|
Get inside! Sample the range of functionality easily built with JMSL Library for Time Series Data Analysis, Heat Maps, Portfolio Optimization, Monte Carlo Simulation, Stock Price Charting and more. Download Now! |
|
#1
|
|||
|
|||
|
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. |
|
#2
|
|||
|
|||
|
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).] |
|
#3
|
|||
|
|||
|
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).] |
|
#4
|
|||
|
|||
|
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] |
|
#5
|
|||
|
|||
|
<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).] |
|
#6
|
|||
|
|||
|
Thank you! Yes, it's time for me to dig into it.
Nam. |
|
#7
|
|||
|
|||
|
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> |
![]() |
| Viewing: Dev Shed Forums > Programming Languages > Perl Programming > Process value from TEXTAREA. Help Please!!! |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|