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

    Join Date
    Sep 2000
    Posts
    6
    Rep Power
    0
    Hi everyone,

    Thanks to anyone who can help me out. I'm completely new to Perl and I want to do something which I am sure is extremly simple.

    All I want to do is read the value of a form element from page 1 into a variable into page 2.

    $MyVariable = What the hell goes here!?!?

    Thanks to anyone who responds.

    Judder.
  2. #2
  3. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jun 2000
    Posts
    71
    Rep Power
    14
    You must read data submitted by form like this:
    <BLOCKQUOTE><font size="1" face="Verdana,Arial,Helvetica">code:</font><HR><pre>
    # Get the form variables

    if ($ENV{'REQUEST_METHOD'} eq 'GET') {
    $buffer = $ENV{'QUERY_STRING'};
    }
    else {
    read(STDIN, $buffer, $ENV{'CONTENT_LENGTH'});
    }

    # Break em up into a format the script can read

    @pairs = split(/&/, $buffer);
    foreach $pair (@pairs) {
    ($name, $value) = split(/=/, $pair);
    $value =~ tr/+/ /;
    $value =~ s/%([a-fA-F0-9][a-fA-F0-9])/pack("C", hex($1))/eg;
    $value =~ s/<!--(.|n)*-->//g;
    $value =~ s/<([^>]|n)*>//g;
    $FORM{$name} = $value;
    }
    [/code]
    This reads forms submitted by GET or POST method. If you had text field in form named "email" you will get variable in Perl $FORM{'email'} which contains submitted data, and so on for every form element.

    i.e.
    print "Email: $FORM{'email'}";
  4. #3
  5. No Profile Picture
    Junior Member
    Devshed Newbie (0 - 499 posts)

    Join Date
    Sep 2000
    Posts
    6
    Rep Power
    0
    thats great, thanks!

IMN logo majestic logo threadwatch logo seochat tools logo