inblosam has asked for the wisdom of the Perl Monks concerning the following question:
From a form like that I need to keep the components together that end in the same number so I can do something with it from the database. I found a mailing list post that suggested the following, but I kept getting an error from it:<form method="get" action="test_list.html"> <input type="hidden" name="LineItem" value="1" /> First Number: <input type="text" name="first-1" /><br /> Second: <input type="text" name="second-1" /><br /> Third: <input type="text" name="third-1" /> </p> <p> <input type="hidden" name="LineItem" value="2" /> First Number: <input type="text" name="first-2" /><br /> Second: <input type="text" name="second-2" /><br /> Third: <input type="text" name="third-2" /> </p> <input type="submit" name="a" value="go"> </form>
I tried a few things but my main problem was getting the LineItem variable into an array (not an array of arrays). So it only gets one of the sets of variables.foreach (values $ARGS{LineItem}) { $SQL->execute( $PONum, $ARGS{"first-${i}"}, $ARGS{"second-${i}"}, $ARGS{"third-${i}"} ); }
I am guessing I am getting CLOSE, but I can't quite complete it without some help. Thanks!my @lineitems = $ARGS{"LineItem"}; foreach my $line (@lineitems) { print "line is @$line[0]"; print $ARGS{"first-@$line[0]"}; print $ARGS{"second-@$line[0]"}; print $ARGS{"third-@$line[0]"}; }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Parsing cgi variable lists
by tlm (Prior) on Jun 29, 2005 at 13:19 UTC | |
|
Re: Parsing cgi variable lists
by fmerges (Chaplain) on Jun 29, 2005 at 13:50 UTC | |
|
Re: Parsing cgi variable lists
by tcf03 (Deacon) on Jun 29, 2005 at 13:21 UTC | |
|
Re: Parsing cgi variable lists
by inblosam (Monk) on Jun 29, 2005 at 14:51 UTC | |
by davidrw (Prior) on Jun 29, 2005 at 15:37 UTC | |
|
Re: Parsing cgi variable lists
by inblosam (Monk) on Jun 29, 2005 at 13:32 UTC |