bassplayer has asked for the wisdom of the Perl Monks concerning the following question:
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
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: CGI Parameters in order
by Mr. Muskrat (Canon) on May 03, 2002 at 17:40 UTC | |
|
Re: CGI Parameters in order
by tadman (Prior) on May 03, 2002 at 17:52 UTC | |
|
Re: CGI Parameters in order
by erikharrison (Deacon) on May 03, 2002 at 17:53 UTC | |
|
Re: CGI Parameters in order
by tachyon (Chancellor) on May 04, 2002 at 07:36 UTC | |
|
Re: CGI Parameters in order
by ehdonhon (Curate) on May 03, 2002 at 19:08 UTC | |
by bassplayer (Monsignor) on May 03, 2002 at 19:22 UTC |