Re: CGI.pm param question

2002-10-23 Thread Ovid
--- Nikola Janceski [EMAIL PROTECTED] wrote:
 is there a function that does this or something similar in CGI.pm?
 
 ## print start_form and other stuff
 
 print map { hidden($_, param($_)) } param(); # pass remaining info
 
 ## end form stuff here
 
 PS. what's the easiest way to pass parameters that have more than one value
 using a similar method above?
 
 Nikola Janceski

As I don't know exactly what you are asking, I can only guess as to your meaning.

I *think* what you are asking is how do I maintain my variables from one invocation 
of the script
to the next?  The good news it, if you're using CGI.pm's html generating functions, 
this is done
for you (usually).  If, however, those parameters are elsewhere, then it seems to me 
that you want
hidden fields to hold all of the form values.  If so, this is easy.  The CGI::hidden 
function will
conveniently output all of the hidden fields necessary to contain your form values.  
Here's a
two-line demonstration:

use CGI qw/:standard/;
print hidden( $_ ) foreach param();

Save that as 'test.pl' and run it as follows:

 perl test.pl color=red color=green name=Ovid

You should get output similar to the following (I've changed the output to show each 
hidden field
on a separate line):

input type=hidden name=color value=red /
input type=hidden name=color value=green /
input type=hidden name=name value=Ovid /

Note that there is one hidden field for each paramter (a total of three), even though 
only two
parameters, 'color' and 'name', were supplied.  And yes, the param() function only 
returns the
names of the two parameters, not a list comprised of qw/ color color name /.

Cheers,
Ovid

=
Ovid on http://www.perlmonks.org/
Someone asked me how to count to 10 in Perl:
push@A,$_ for reverse q.e...q.n.;for(@A){$_=unpack(q|c|,$_);@a=split//;
shift@a;shift@a if $a[$[]eq$[;$_=join q||,@a};print $_,$/for reverse @A

__
Do you Yahoo!?
Y! Web Hosting - Let the expert host your web site
http://webhosting.yahoo.com/

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




CGI.pm param question

2002-10-22 Thread Nikola Janceski
is there a function that does this or something similar in CGI.pm?

## print start_form and other stuff

print map { hidden($_, param($_)) } param(); # pass remaining info

## end form stuff here

PS. what's the easiest way to pass parameters that have more than one value
using a similar method above?

Nikola Janceski

Only the wisest and the stupidest of men never change.
-- Confucius 




The views and opinions expressed in this email message are the sender's
own, and do not necessarily represent the views and opinions of Summit
Systems Inc.


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