in reply to Re: Passing a lot of form values
in thread Passing a lot of form values

Okay... first, especially if you're new at anything, comments are your friend. Spell out in detail what you expect to start with, what you expect to end with, and how you expect to get there. You'll help yourself figure it out, and others. Anyway, am I correct in thinking that this is the collection of data you're needing to move around?
my %incoming = &read_input; # Read information into associated # array %incoming. my $qty = $incoming{'qty'}; # Fetch the text from the array. my $type = $incoming{'type'}; # Fetch the text from the array. my $equip = $incoming{'equip'}; # Fetch the text from the array. my $dept = $incoming{'dept'}; # Fetch the text from the array. my $fstore = $incoming{'fstore'}; # Fetch the text from the array. my $dreceived = $incoming{'dreceived'}; # Fetch the text from the arra +y. my $rstore = $incoming{'rstore'}; # Fetch the text from the array. my $ringstore = $incoming{'ringstore'}; # Fetch the text from the arra +y. my $dated = $incoming{'dated'}; # Fetch the text from the array. my $comment = $incoming{'comment'}; # Fetch the text from the array. my $id = $incoming{'id'}; # Fetch the text from the array. my $action = $incoming{'action'}; # Fetch the text from the array.
If that's the case, you might consider storing the information as a hash...
my %data; $data{'qty'} = $incoming{'qty'}; $data{'type'} = $incoming{'type'}; # etc...
And then after you've populated your hash, add it to a list...
my @hashes; push @hashes, $data;
And then you can just access the members of the list sequentially when you need to update the database. Or am I missing something in your code?

Replies are listed 'Best First'.
Re^3: Passing a lot of form values
by Trihedralguy (Pilgrim) on May 23, 2007 at 15:36 UTC
    That seems like what I may need to do. I can develop my own "logic" to process this stuff". But I think you've answered my simple question about how I can go about sending and receiving (the possibility of 150 rows of data) my data using form variables.
    I have a quick quesiton, when you say "And then after you've populated your has, add it to a list". What do you mean by this?
    Also when the time comes how to I call a row of data. So if I have like 1 2 3, 1 2 3 (qty, number, stock) How do I call row one then row two of the $data?
      Not 100% sure ... but I would think to access a row it may be as simple as:
      my %row = $hashes[cnt]; where cnt is the row that you want to access. Or even better: foreach my %row (@hashes){ #then access each item in the hash with $row{qty}, or #go through all the keys using "foreach my $key (sort keys %row)" }
      -- Carmen
      By adding the hash to a list, I mean generate an array of hashes. Presuming you generate an array of hashes that looks like this:
      @listOfHashes = { { qty => 1, number => 2, stock => 3, } { qty => 7, number => 8, stock => 9, } }
      You would access members of that list like this:
      print "$listOfHashes[1]{qty}";
      This would print the number 7.