Hello! I frequently develop websites with multi-page forms and need to pass data through the forms efficiently. I developed three routines (below) to do this. My question is: This seems like such a common thing to that either there should also be a solution (that I haven't noticed) such as routines in CGI.pm, or there is a good way to avoid this. Are you all using routines like the ones below? If not, what are you using?
use CGI qw/:standard/; # An efficient way to pass param variables on through a page sub export_form_vars { my @input = @_; my $html = "\n"; foreach my $key (@input) { my @vars = param $key; foreach my $val (@vars) { $val = escapeHTML($val); $html .= "<input type=hidden name=\"$key\" value=\"$val\"> +\n" } } return $html } sub export_form_vars_to_query_string { my @input = @_; my $html; foreach my $var (@input) { $var = escape($var); $html .= '&amp;'."$var=".param($var); } $html =~ s/^&amp;//; return $html } sub export_entire_form { my $html; foreach my $k (param) { my $v = param($k); $html .= '<input type=hidden name="'.escapeHTML($k).'" val +ue="'.escapeHTML($v)."\">\n" } return $html; }

In reply to functions for passing variables through multiple CGI forms by markjugg

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.