Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Turn $CGI collection to a single hash

Status
Not open for further replies.

1DMF

Programmer
Joined
Jan 18, 2005
Messages
8,795
Location
GB
I have a form, it's submitted to a CGI to be merged with a template to send an HTML email.

As you probably know the Template module works on arrays of hashes, so is there an easy way to make the $cgi->param('var_name') variables into a single index array of a hash to send to the template for processing?

so I have

%hash = a hash of value pairs for every form field held in the CGI object and then make $array[$[] = %hash;

thanks

1DMF

"In complete darkness we are all the same, only our knowledge and wisdom separates us, don't let your eyes deceive you.
 
ok I think I got it
Code:
my %form = $cgi->Vars;
:-)


"In complete darkness we are all the same, only our knowledge and wisdom separates us, don't let your eyes deceive you.
 
well apart from the fact that because the form is X/HTML 1.1 and so none of the input tags have attribute 'name' the $cgi->Vars; is empty?

any ideas?

1DMF

"In complete darkness we are all the same, only our knowledge and wisdom separates us, don't let your eyes deceive you.
 
ok my bad, it was erroring on the name tag for 'form' not the 'input' tag!

"In complete darkness we are all the same, only our knowledge and wisdom separates us, don't let your eyes deceive you.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top