Please forgive me if this question has been asked before. I Googled and Super Searched no avail. When using CGI.pm, I am wondering if there is any way to get the params in the order that they were in the form from which they came.
I recently had to dump a large (50+ fields) form into a text file and an email as quickly as possible. I dumped them into a hash (as I often do):
and then put them into the two destinations:my @params; foreach ( $q->param() ) { push @params, $_; push @params, $q->param($_); } my %param = @params;
This was a quick fix to meet an irrational deadline. It was code to be replaced later when we had more time to properly insert the data into the appropriate db tables. I was then informed that for the email, the information needed to be in the order it was in on the form, and so I spent quite a bit of time arranging them by typing each one out.foreach my $key ( keys %param ) { print FILE "$key\t$param{$key}\n"; $email_content .= "$key:\t$param{$key}\n"; }
Could this have been done another way? I could see this coming up again in a few months.$email_content .= "email_address:\t$param{email_address}\n";
bassplayer
In reply to CGI Parameters in order by bassplayer
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |