Yes,

You can build your cgi page looping through your hash keys and creating a dynamic page. Then re-assign the values and pass them in as hidden parameters.

As long as you import your parameters into each form tag and then submit them out you can pass parameters for ever.

Here is somewhat of an in depth example but I am sure you can see how I have passed them in the code.

#!/usr/bin/perl -wT use strict; use CGI qw(:standard); my $var1 = param('one'); my $var2 = param('two'); my $var3 = param('three'); my $var4 = param('four'); my $thisapp = "test_pass"; my %stuff = ( Name => "Elijah", Age => "74", Sex => "Female", Location => "/home"); if (!$var1 && !$var2 && !$var3 && !$var4) { new(); }elsif (!$var1 || !$var2 || !$var3 || !$var4) { missing(); }else{ success(); } sub new { print "Content-type: text/html; charset=ISO-8859-1\n\n"; print <<NEW; <html> <head><title>NEW</title></head> <body> <form name="pass" method="post" action="$thisapp"> NEW for my $key ( keys %stuff ) { my $value = $stuff{$key}; print "<p>Name:&nbsp;<input type=\"text\" name=\"one\" value=$va +lue maxlength=\"30\" style=\"width: 180px\"></p>" if ($key eq "Name") +; print "<p>Age:&nbsp;<input type=\"text\" name=\"two\" value=$val +ue maxlength=\"30\" style=\"width: 180px\"></p>" if ($key eq "Age"); print "<p>Sex:&nbsp;<input type=\"text\" name=\"three\" value=$v +alue maxlength=\"30\" style=\"width: 180px\"></p>" if ($key eq "Sex") +; print "<p>Location:&nbsp;<input type=\"text\" name=\"four\" valu +e=$value maxlength=\"30\" style=\"width: 180px\"></p>" if ($key eq "L +ocation"); } print <<NEW; <p><input type="submit" value="Pass Data" style="width: 150px"></p> </form> </body> </html> NEW } sub missing { print "Content-type: text/html; charset=ISO-8859-1\n\n"; print <<MISSING; <html> <head><title>MISSING</title></head> <body> <p>You are missing an input value!</p> </body> </html> MISSING } sub success { print "Content-type: text/html; charset=ISO-8859-1\n\n"; print <<SUCCESS; <html> <head><title>SUCCESS</title></head> <body> <form name="pass" method="post" action="$thisapp"> <input type="hidden" value=$var1 name="one"> <input type="hidden" value=$var2 name="two"> <input type="hidden" value=$var3 name="three"> <input type="hidden" value=$var4 name="four"> <p>Data passed was:</p> <p>Name: $var1</p> <p>Age: $var2</p> <p>Sex: $var3</p> <p>Location: $var4</p> <p><input type="submit" value="Pass Data" style="width: 150px"></p> </form> </body> </html> SUCCESS }
Here I assign the values from the hash at first but once loaded I pass them using hidden parameters. You can see a working example of this script here.

Hope this is of some use to you.


In reply to Re^3: Perl/Cgi: Passing Hash Data Within by Elijah
in thread Perl/Cgi: Passing Hash Data Within by EchoAngel

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.