in reply to Re: Re: Re: (Ovid -- bug in your hand-rolled CGI code) Re: Pushing w/ an associative array?
in thread Pushing w/ an associative array?

I'm not sure what you mean. What variable name don't you get? The variable names are all defined in your program.

What my snippet does is to populate a hash called %form. The keys of the hash are the CGI parameters names and the values are either the CGI parameter values or a reference to an array of values if the parameter is multi-valued.

--
<http://www.dave.org.uk>

"Perl makes the fun jobs fun
and the boring jobs bearable" - me

  • Comment on Re: Re: Re: Re: (Ovid -- bug in your hand-rolled CGI code) Re: Pushing w/ an associative array?

Replies are listed 'Best First'.
Re: Re: Re: Re: Re: (Ovid -- bug in your hand-rolled CGI code) Re: Pushing w/ an associative array?
by Anonymous Monk on Dec 27, 2000 at 22:34 UTC
    What I need to do is, since the script has to be able to handle ANY form that gets thrown at it, is take the variable names and put them in an array. That way, I can go through the array and use the param() function to get the value. When I do just a blank param() I only get the values.

      merlyn is right about what he says about security risks, but my code does does handle any form that is thrown at it. You can get the list of form parameters it has processed by using:

      keys %form
      --
      <http://www.dave.org.uk>

      "Perl makes the fun jobs fun
      and the boring jobs bearable" - me

      This is already smelling of a potential BIG security hole. Can you tell us more about your application? Why would you need to be able to handle any combination of form elements?

      -- Randal L. Schwartz, Perl hacker

        Basically I've got a few different forms for people to submit stuff, one is a grocery list, the other is a list of people to contact in an emergency, etc.

        I'd like to make it so that this script can handle either form, instead of writing out a separate form for each script. Although now it seems like its taking way longer to code around this =)

        Thats the reason I need to have the name of the variable that the value is coming with.