Beefy Boxes and Bandwidth Generously Provided by pair Networks
Syntactic Confectionery Delight
 
PerlMonks  

Re: CGI problem: trying to assign parameters in a loop

by bjelli (Pilgrim)
on Jan 20, 2002 at 00:01 UTC ( #140121=note: print w/ replies, xml ) Need Help??


in reply to CGI problem: trying to assign parameters in a loop

The problem must be somewhere else in your script. I just cut-n-pasted your code, and got it to run in 2 minutes. Here's my complete code:

#!/usr/bin/perl use CGI ('param'); print "Content-type: text/html\n\n"; print "<html><h1>Testing bigharas inventory problem</h1>\n"; @inventory = qw( camel llama ); if (param('action') eq 'submit') { print "Reading Data...<br>\n"; foreach (@inventory) { my $qty = param("quantity$_"); $qty{$_} = $qty } print "<table border=1>\n"; foreach (@inventory) { print "<TR>"; print "<TD>$_</TD>"; print "<TD>$inv_prices{$_}</TD>"; print "<TD>$qty{$_}</TD></TR>"; } print "</table>\n"; print "That's all\n"; } else { print "<form><table border=1>\n"; foreach (@inventory) { print "<TR>"; print "<TD>$_</TD>"; print "<TD>$inv_prices{$_}</TD>"; print "<TD>$inv_weights{$_}</TD>"; print "<TD><input type=\"text\" size=\"4\" name=\"quantity$_\" + ></TD></TR>" } print "</table><input type=submit name=action value=submit>\n"; }
--
Brigitte    'I never met a chocolate I didnt like'    Jellinek
http://www.horus.com/~bjelli/         http://perlwelt.horus.at


Comment on Re: CGI problem: trying to assign parameters in a loop
Download Code

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://140121]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others examining the Monastery: (5)
As of 2015-07-04 10:34 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    The top three priorities of my open tasks are (in descending order of likelihood to be worked on) ...









    Results (59 votes), past polls