in reply to Re: looking for better solution
in thread looking for better solution

Couldn't you use a where clause in the sql query to only grab the ones with quantity and skid set?

Your code is pretty confusing for a couple reasons. The use of print mixed in with your insertion of text into an array ref mixed with that incrementing variable makes it hard to follow.

The following does the same thing as your code does, but I think it makes it clear exactly what is going on. I'm still confused by the mix of printing plain text with HTML, and the strings your are putting into the array are odd as well.

my $ordno = 1; while (my $ref = $GetWOData->fetchrow_hashref()) { print "$ref->{'Ord_No'}\n"; print "$ref->{'Item_No'}\n"; print "<input type=\"text\" name=\"qty$ordno\" value=\"\" size=\ +"6\">\n"; #Qty of parts print "$ref->{'Item_Desc_1'}\n"; print "<input type=\"text\" name=\"skd$ordno\" value=\"\" size=\ +"6\">\n"; #Num of skids print "$ref->{'Cus_Name'}\n"; push @{$orders[$ordno]}, "$ref->{'Ord_No'} | $ref->{'Item_No'}"; push @{$orders[$ordno]}, "0"; push @{$orders[$ordno]}, "$ref->{'Item_Desc_1'} | $ref->{'Item_Desc_ +2'}"; push @{$orders[$ordno]}, "0"; push @{$orders[$ordno]}, "$ref->{'Cus_Name'}"; $ordno++; } $GetWOData->finish();

___________
Eric Hodges

Replies are listed 'Best First'.
Re^3: looking for better solution
by BikerDuck (Initiate) on Nov 01, 2007 at 14:59 UTC
    Thanks.. i'll use the push method to build the array.

    I think i found a solution to what i want to do.. Using CGI::Ajax i think i can output this table with the form elements, and then only put items in the array when they enter data.

    The query problem is that the Quantity can change on the Floor (Scrap) and Skid quantity will also change dynamically so i can't grab that data.. i have to rely on users to input that

    I will post final outcome once i work out all of the little details..

      It sounds like you might be a little confused about the flow of CGI.

      Your perl script generates an HTML form, when submitted that form sends the data back to which ever script you want (by calling that script agian) which would then generate another HTML page and the email. So when processing the return from the script you will know the quantities and skids.


      ___________
      Eric Hodges