Hello all,

I've written a cgi page whose form I've set up to open
another window. I'm having problems getting an input
variable to pass from the originating page to the page
that's being opened. I've included some snippits from
my code below. I can't even get it to work in this
simple example.

Can anyone help me out?

Thanks!

-Stephen Spalding

Original CGI page:
#!/usr/bin/perl
print "Content-type: text/html\n\n";

print "<HTML>\n";
print "<BODY BGCOLOR=#F5FFFA>\n";

print "<SCRIPT language=\"JavaScript\">\n";
print "function open_schedule()\n";
print "   {\n";
print "   per_seat_var =
window.open(\"sample2.pl\",\"sample2\",\"status=yes,scrollbars=yes,resizable=yes,height=500,width=800\")\n";
print "   }\n";
print "</SCRIPT>\n";

print "<TABLE width=\"600\">\n";
print "<TR>\n";
print "  <TD width=\"600\" align=center>\n";
print "    <B>Select a year to view:</B>\n";
print "  </TD>\n";
print "</TR>\n";
print "</TABLE>\n";

print "<FORM method=\"post\"
action=\"display_schedule.pl?FULL_SCREEN=true\">\n";
print "<TABLE width=\"600\">\n";
print "<TR>\n";
print "  <TD width=\"200\" align=right>\n";
print "    <B>Year: </B>\n";
print "  </TD>\n";
print "  <TD width=\"100\" align=left>\n";
print "    <select name=\"year\" size=\"1\">\n";
if ( $year eq '2002' )
        { print "    <option value=\"2002\"
selected>2002\n"; }
else
        { print "    <option value=\"2002\">2002\n"; }
if ( $year eq '2003' )
        { print "    <option value=\"2003\"
selected>2003\n"; }
else
        { print "    <option value=\"2003\">2003\n"; }
if ( $year eq '2004' )
        { print "    <option value=\"2004\"
selected>2004\n"; }
else
        { print "    <option value=\"2004\">2004\n"; }
print "    </select>\n";
print "  </TD>\n";
print "  <TD width=\"100\" align=left>\n";
print "    <INPUT TYPE=\"button\"
NAME=\"submitButton\" VALUE=\"Go!\"";
print "    onClick=\"open_schedule()\">";
print "  </TD>\n";
print "</TR>\n";
print "</TABLE>\n";
print "</FORM>\n";
print "</BODY>\n";
print "</HTML>\n";



Here's the script that's being opened:


#!/usr/bin/perl
print "Content-type: text/html\n\n";

read(STDIN, $buffer, $ENV{'CONTENT_LENGTH'});
@pairs = split(/&/, $buffer);
foreach $pair (@pairs)
        {
        ($name, $value) = split(/=/, $pair);
        $value =~ tr/+/ /;
        $value =~
s/%([a-fA-F0-9][a-fA-F0-9])/pack("C", hex($1))/eg;

        # full_screen eq true
        if ( $name eq 'year' ) { $year = $value; }
        }

print "<HTML>\n";
print "<BODY BGCOLOR=#F5FFFA>\n";

print "<TABLE width=\"700\">\n";
print "<TR>\n";
print "  <TD width=\"300\" align=center>\n";
print "  year = $year\n";
print "  </TD>\n";
print "</TR>\n";
print "</TABLE>\n";
print "</BODY>\n";
print "</HTML>\n";



__________________________________________________
Do you Yahoo!?
Yahoo! Mail Plus - Powerful. Affordable. Sign up now.
http://mailplus.yahoo.com

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

Reply via email to