You can read all the query param names into an array using the param
method of cgi.cpm. Then you just loop through the array.

See:
http://search.cpan.org/~lds/CGI.pm-3.29/CGI.pm#FETCHING_THE_NAMES_OF_ALL
_THE_PARAMETERS_PASSED_TO_YOUR_SCRIPT:

@params = $query->param
foreach my $param ( @params ) {
  # do your stuff. Watch for params you don't care about (submit
button,etc)
  next if $param eq "Submit"
  print "$param: $query->param($param)\n"
}

>>-----Original Message-----
>>From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]
>>Sent: Wednesday, June 13, 2007 12:20 PM
>>To: beginners-cgi@perl.org
>>Subject: Variable Name Survey Form Input
>>
>>Hi.  I have a problem with a CGI Script I'm currently working on.
>>
>>I have a situation where members have to take an on-line weekly
survey,
>>and
>>leave their comments for any number of questions on that survey.  This
>>weekly survey will have different questions, and a different number
>>(quantity) of questions every week.  (i.e. one survey might have 5
>>quesitions, another survey might have 100 questions.)
>>
>>The problem I have is two-fold:
>>
>>1. I can't name each question in the form like this:  Question 1,
Question
>>2, Question 3, etc.
>>Instead, the form name for each question will be an unique name coded
for
>>that specific survey that will change from form-to-form.  (i.e.
>>p20070406_01, b20070613x_100, etc.).
>>
>>2. I need to create a CGI program flexible enough so that any number
of
>>survey responses can be read.  So a survey with 2 questions can be
read as
>>easily as one with 200 questions without having me modify the CGI
program
>>every week.
>>
>>Responses to these surveys will be sent to my email address.  (A
process
>>which I know how to do.)
>>
>>Any ideas?  (I'm thinking about some sort of an array-reading input
>>routine, but haven't a clue on how to do this.)
>>
>>Many thanks in advance!
>>
>>-- Al W.
>>
>>
>>
>>
>>--
>>To unsubscribe, e-mail: [EMAIL PROTECTED]
>>For additional commands, e-mail: [EMAIL PROTECTED]
>>http://learn.perl.org/


-----Message Disclaimer-----

This e-mail message is intended only for the use of the individual or
entity to which it is addressed, and may contain information that is
privileged, confidential and exempt from disclosure under applicable law.
If you are not the intended recipient, any dissemination, distribution or
copying of this communication is strictly prohibited. If you have
received this communication in error, please notify us immediately by
reply email to [EMAIL PROTECTED] and delete or destroy all copies of
the original message and attachments thereto. Email sent to or from the
Principal Financial Group or any of its member companies may be retained
as required by law or regulation.

Nothing in this message is intended to constitute an Electronic signature
for purposes of the Uniform Electronic Transactions Act (UETA) or the
Electronic Signatures in Global and National Commerce Act ("E-Sign")
unless a specific statement to the contrary is included in this message.

While this communication may be used to promote or market a transaction
or an idea that is discussed in the publication, it is intended to provide
general information about the subject matter covered and is provided with
the understanding that The Principal is not rendering legal, accounting,
or tax advice. It is not a marketed opinion and may not be used to avoid
penalties under the Internal Revenue Code. You should consult with
appropriate counsel or other advisors on all matters pertaining to legal,
tax, or accounting obligations and requirements.

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


Reply via email to