#1
  1. No Profile Picture
    Junior Member
    Devshed Newbie (0 - 499 posts)

    Join Date
    Aug 2000
    Location
    Lanham,MD,US
    Posts
    7
    Rep Power
    0
    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. #2
  3. No Profile Picture
    Contributing User
    Devshed Novice (500 - 999 posts)

    Join Date
    Aug 2000
    Location
    Indiana
    Posts
    614
    Rep Power
    15
    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).]
  4. #3
  5. No Profile Picture
    freebsd
    Guest
    Devshed Newbie (0 - 499 posts)
    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).]
  6. #4
  7. No Profile Picture
    Junior Member
    Devshed Newbie (0 - 499 posts)

    Join Date
    Aug 2000
    Location
    Lanham,MD,US
    Posts
    7
    Rep Power
    0
    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]

  8. #5
  9. No Profile Picture
    Contributing User
    Devshed Novice (500 - 999 posts)

    Join Date
    Aug 2000
    Location
    Indiana
    Posts
    614
    Rep Power
    15
    <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).]
  10. #6
  11. No Profile Picture
    Junior Member
    Devshed Newbie (0 - 499 posts)

    Join Date
    Aug 2000
    Location
    Lanham,MD,US
    Posts
    7
    Rep Power
    0
    Thank you! Yes, it's time for me to dig into it.

    Nam.
  12. #7
  13. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    May 2000
    Posts
    73
    Rep 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>

IMN logo majestic logo threadwatch logo seochat tools logo