Chris Devers wrote:
On Fri, 10 Dec 2004, James Taylor wrote:


Hi everyone, wondering if anyone knew how to pass an associative array via POST to mod_perl. Something like:


HTML forms don't really provide for complex data structures, so any solution is going to have to be cobbled together.

I think your best bet is to just have form elements with names like 'searchname', 'searchemail', etc, and just have code on the server to organize it into a hash:

  $search{name}  = $req->param('searchname');
  $search{email} = $req->param('searchemail');

etc.




Eh, score 1 for PHP then. The reason I can't specifically do what you're mentioning is that the field names being passed could be ANYTHING, as the code is for a module I'm writing. Anyway, I went ahead and just made it cheesy, instead of doing field[something], i made all of the input names "field=something", send the hash through a foreach loop - if the name of the field =~ /field/, i split on the = and ditch the first variable. Feh


--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>




Reply via email to