Hi all, I am having a heck of a time trying to figure out how to pass a variable from index.cgi to sum.cgi. I have an online form that displays each student from /etc/passwd on the school server. I can pass "Last Month" and "This Month" but I am not sure how to pass the student name to the other file. Any help would be greatly appreciated

#!/usr/bin/perl use strict; use warnings; use CGI qw/:standard/; use CGI::Carp qw/fatalsToBrowser/; my $count = 3; my $line; my @list; my $ifile = "/etc/passwd"; my %user; my %name; my $key; open(my $IN, "<", $ifile); while(<$IN>) { chomp; my @data = split(/:/); $user{$data[0]} = $data[2]; my @tmp = split(/,/, $data[4]); $name{$data[0]} = $tmp[0]; } close($IN); print header(), start_html( -title=>'Account Summary'); print<<EOHTML; <!DOCTYPE html> <head> <title>Account Summary</title> </head> <body> <h1>Account Summary Gateway</h1> <p>Select which month(s)you would like to summarize: <form action="sum.cgi" method="get"> <input type="checkbox" name="ThisMonth" value="current +">This Month</br> <input type="checkbox" name="LastMonth" value="last">L +ast Month <p>Select one of the $count accounts to summarize:</p> <select name="$key" size="15" multiple="multiple"> EOHTML foreach my $key(sort keys %user) { if($user{$key} > 1001) { print"<option value=\"$key\">$key \($name{ +\"$key\"}\)</option><br />"; #print "$key $name{$key}\n"; } } print<<EOHTML; </select></br> <input type ="submit" name="sbutton" value="Go!"> </form> </body> EOHTML

In reply to Passing variable to another CGI.pm program by deathmetalscottie

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.