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
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |