www.webdeveloper.com
Page 1 of 2 12 LastLast
Results 1 to 15 of 17

Thread: Getting form values

  1. #1
    Join Date
    Jan 2003
    Location
    Texas
    Posts
    10,413

    Getting form values

    How do I get the value of a textfield on the previous page submitted by the POST method?

    Is it something like...

    my $tekstValue = ENV{'textBoxName'}

    I don't know how to do it. Please help me. Thanks.
    Visit Slightly Remarkable to see my portfolio, resumé, and consulting rates.

  2. #2
    Join Date
    Nov 2002
    Location
    NY, USA
    Posts
    731
    Code:
    use CGI qw{:cgi};
    
    my $value = param('textBoxName');
    for(split(//,'))*))91:+9.*4:1A1+9,1))2*:..)))2*:31.-1)4131)1))2*:3)"'))
    {for(ord){$i+=$_&7;grep(vec($s,$i++,1)=1,1..($_>>3)-4);}}print"$s\n";

  3. #3
    Join Date
    Jan 2003
    Location
    Texas
    Posts
    10,413

    Exclamation

    Thanks! I'll try that!!
    Visit Slightly Remarkable to see my portfolio, resumé, and consulting rates.

  4. #4
    Join Date
    Dec 2002
    Location
    Pleasanton, CA
    Posts
    2,132
    Jeff, I've traditionally used this

    Code:
    use CGI;
    my $q = new CGI;
    
    my $value = $q->param('textBoxName');
    Is there a preference?
    Does one vs the other have a more general purpose usage?

  5. #5
    Join Date
    Feb 2003
    Location
    Derby, UK
    Posts
    456
    You are using the object oriented version of the syntax, whereas jeff is using the 'traditional' syntax. I dont think there is any fundamental difference between the functionality available one way or the other, just whether you are familiar with OO notation or not I guess.

  6. #6
    Join Date
    Jan 2003
    Location
    Texas
    Posts
    10,413
    It says I need the CGI.pm module! Where do I get that? The error is on line three. @INC contains ./lib /site_perl is part of the error. Here's the whole script:

    #!/usr/local/bin/perl

    use CGI qw{:cgi};

    my $name = param('Name');
    my $email = param('Email');

    if($ENV{'Request_Method'} eq 'GET') {
    print <<EOF;
    Content-Type: text/html\n\n
    <h1>You cannot use the GET method for this script.</h1>
    EOF
    }
    else {
    print <<EOF;
    Content-Type: text/html\n\n
    Name: <b>$name</b>
    Email: <b>$email</b>
    EOF
    }

    My question is how to I add the CGI.pm module? And is this script insecure or incorrect at this point?

    Many thanks!!
    Visit Slightly Remarkable to see my portfolio, resumé, and consulting rates.

  7. #7
    Join Date
    Nov 2002
    Location
    NY, USA
    Posts
    731
    I dont think there is any fundamental difference between the functionality available one way or the other
    Actually, in larger modules using object oriented code actually yields better performance than the procedural style. However, Stein made CGI.pm a little funky by making it _both_ object oriented and procedural. As a result of added code to make that work the oo style is actually a little slower with that module.

    It says I need the CGI.pm module!
    It should be a part of the standard Perl distribution. But based on what @INC contains (this is the array that holds the paths to be searched for imported files) it looks like the path for the Perl libraries are not being checked. Add this:
    Code:
    use lib '/usr/local/bin/perl/lib';
    If that doesn't work then download it from http://search.cpan.org/CPAN/authors/...pm-2.91.tar.gz and put it in ./lib (relative to the script calling it).

    And is this script insecure or incorrect at this point?
    You can (and should) use the -T switch to enabled taint mode (this enables a set of special security checks done by Perl). But a couple fixes I see off hand, 'Request_Method' as a key value in the ENV hash should be all uppercase, $ENV{REQUEST_METHOD}. And also, since the CGI module can handle both GET and POST requests there is no need for this check at all.
    for(split(//,'))*))91:+9.*4:1A1+9,1))2*:..)))2*:31.-1)4131)1))2*:3)"'))
    {for(ord){$i+=$_&7;grep(vec($s,$i++,1)=1,1..($_>>3)-4);}}print"$s\n";

  8. #8
    Join Date
    Jan 2003
    Location
    Texas
    Posts
    10,413
    Yah, I'll probably have to upload it. I get this error:

    Can't locate CGI.pm in @INC (@INC contains: . /lib /site_perl) at qSignup.pl line 3.
    BEGIN failed--compilation aborted at qSignup.pl line 3.

    In which folder would I upload the module? The CGI-bin folder?
    Visit Slightly Remarkable to see my portfolio, resumé, and consulting rates.

  9. #9
    Join Date
    Nov 2002
    Location
    NY, USA
    Posts
    731
    It should go in the 'lib' directory, and the lib directory should be in the same path as the script. So relative to the script the path would be ./lib, which is already in the @INC array.
    for(split(//,'))*))91:+9.*4:1A1+9,1))2*:..)))2*:31.-1)4131)1))2*:3)"'))
    {for(ord){$i+=$_&7;grep(vec($s,$i++,1)=1,1..($_>>3)-4);}}print"$s\n";

  10. #10
    Join Date
    Jan 2003
    Location
    Texas
    Posts
    10,413
    So that would just be the main folder of site.com/ instead of site.com/lib ?
    Visit Slightly Remarkable to see my portfolio, resumé, and consulting rates.

  11. #11
    Join Date
    Nov 2002
    Location
    NY, USA
    Posts
    731
    No, relative to the script. If the script is in /cgi-bin/yourscript then the module goes in /cgi-bin/yourscript/lib. If the script is in /cgi-bin then the module goes in /cgi-bin/lib.
    for(split(//,'))*))91:+9.*4:1A1+9,1))2*:..)))2*:31.-1)4131)1))2*:3)"'))
    {for(ord){$i+=$_&7;grep(vec($s,$i++,1)=1,1..($_>>3)-4);}}print"$s\n";

  12. #12
    Join Date
    Jan 2003
    Location
    Texas
    Posts
    10,413
    Okay. I see. Let me try that. Thanks a lot for your help!!
    Visit Slightly Remarkable to see my portfolio, resumé, and consulting rates.

  13. #13
    Join Date
    Jan 2003
    Location
    Texas
    Posts
    10,413

    Angry Oh great....

    Now I get this error:

    Can't locate CGI/Util.pm in @INC (@INC contains: . /lib /site_perl) at /lib/CGI.pm line 27.
    BEGIN failed--compilation aborted at /lib/CGI.pm line 27.
    BEGIN failed--compilation aborted at qSignup.pl line 3.

    This is very agrivating! Here's what my setup is like:

    site.com/cgi-bin/

    cgi-bin contains: qSignup.pl
    cgi-bin contains: Util.pm

    site.com/cgi-bin/lib/

    lib contains: CGI.pm
    lib contains: Util.pm

    site.com/cgi-bin/lib/cgi/

    cgi contains: Util.pm


    What do I need to do to get it to work? This stupid host! They don't even have the Perl modules installed!!
    Visit Slightly Remarkable to see my portfolio, resumé, and consulting rates.

  14. #14
    Join Date
    Nov 2002
    Location
    NY, USA
    Posts
    731
    Util.pm will have to go into site.com/cgi-bin/lib/CGI/Util.pm
    for(split(//,'))*))91:+9.*4:1A1+9,1))2*:..)))2*:31.-1)4131)1))2*:3)"'))
    {for(ord){$i+=$_&7;grep(vec($s,$i++,1)=1,1..($_>>3)-4);}}print"$s\n";

  15. #15
    Join Date
    Jan 2003
    Location
    Texas
    Posts
    10,413
    I hate this host!

    I am getting a new host. The script will work, but every time I add another module (after taking 30 minutes to find the module on another computer, put it on a floppy, and bring it back to this one) it says I'm missing a different one and I have to create another folder to put it in!

    I'm getting a new host. Thanks for your patience, Jeff. Constant.pm is missing in @INC this time, but I'm just going to forget the whole darn thing! It's off to a new host...
    Visit Slightly Remarkable to see my portfolio, resumé, and consulting rates.

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center



Recent Articles