I think this is what you wanted...

use CGI qw/:standard/;

# Loop over each field name in the form
foreach my $name ( param() ) {

  # If the name starts with "ID_" ending with a number
  if ( $name =~ /^ID_\d+$/ ) {
    print "It's an ID! The value = " . param($name) . "<br>";
  }
  # If the name starts with "user_" ending with a number
  elsif ( $name =~ /^user_\d+$/ ) {
    print "It's a user! The value = " . param($name) . "<br>";
  }
  # etc, etc, etc...
}

Rob


-----Original Message-----
From: Imtiaz ahmad [mailto:[EMAIL PROTECTED]]
Sent: Monday, January 21, 2002 12:13 PM
To: Hanson, Robert; '[EMAIL PROTECTED]'
Subject: RE: Question -


Can we read multiple variable like that?
For example, if we have 
ID_1, ID_2, ID_3 ...ID_n and user_1, user_2, user_3 ...user_n
name_1, name_2, name_3 ...name_n and phone_1, phone_2, phone_3 ...phone_n

thanks.


-----Original Message-----
From: Imtiaz ahmad [mailto:[EMAIL PROTECTED]]
Sent: Monday, January 21, 2002 11:58 AM
To: Hanson, Robert
Subject: RE: Question -


thanks again --- it works perfectly.

-----Original Message-----
From: Hanson, Robert [mailto:[EMAIL PROTECTED]]
Sent: Monday, January 21, 2002 11:57 AM
To: 'Imtiaz ahmad';                     
Subject: RE: Question -


You could use CGI.pm.

use CGI qw/:standard/;

foreach my $name ( param ) {
  # Skip everything except ID_# vars
  next unless ( $name =~ /^ID_\d+$/ );
  # Handle variable here
  print "$name = ".param($name);
}

Is that what you were asking or did you want to pass the vars between pages?
If you need to pass them you can either drop them into hidden for fields, or
use some sort of session mgmt (like Apache::Session).

Rob

-----Original Message-----
From: Imtiaz ahmad [mailto:[EMAIL PROTECTED]]
Sent: Monday, January 21, 2002 10:48 AM
To: [EMAIL PROTECTED]
Subject: Question -


Can someone please help me with the following:

I need to have variable names like ID_1, ID_2, ID_3 ...ID_n.
How can I read them on the next page after submitting through a FORM using
POST method?

thanks.

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to