Beefy Boxes and Bandwidth Generously Provided by pair Networks
Welcome to the Monastery
 
PerlMonks  

Re: cgi_handlers.pl

by Purdy (Hermit)
on Nov 06, 2001 at 00:02 UTC ( #123401=note: print w/replies, xml ) Need Help??


in reply to cgi_handlers.pl

I'm not sure how cgi_handlers.pl worked, but I would see how variables are created from the HTML form. Most old CGI scripts I've run into set up some type of hash with the field name as the key and the user-supplied value as the value.

With CGI.pm, you can port your old CGI script and create a hash with the HTML form variables with a simple loop:

use CGI; $query = new CGI; foreach ($query->param()) { $fields{$_} = $query->param($_); } # now you can access the HTML form field 'name' like so: print "Hello, " . $fields{'name'} . "!\n"; # or you can use the CGI.pm methodology (which would mean # you'd have to port all of the instances of your HTML form # variables: print "Hello, " . $query->param('name') . "!\n";

HTH,

Jason

Replies are listed 'Best First'.
Re: Re: cgi_handlers.pl
by Amoe (Friar) on Nov 06, 2001 at 00:10 UTC
    As a side note: to get the params in a hash with CGI you can also do the handy thing:
    use CGI ':cgi-lib'; my %params = Vars;
    Neat.

    --
    my one true love

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://123401]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others drinking their drinks and smoking their pipes about the Monastery: (10)
As of 2019-11-21 13:43 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    Strict and warnings: which comes first?



    Results (104 votes). Check out past polls.

    Notices?