Hi Stephen, In this particular example, you're merely using the onClick event of the form button to open a window and point it to sample2.pl
For this particular case, I would actually create a series of links on the first page (instead of a form) and make those links open a popup and send data to the script via the query string in the URL (using the GET method) SO..in my original window I'd say: <HTML> <HEAD> <script language="javascript"> function openResults(year){ window.open("sample2.pl?year=" + year,"sample2","status=yes,scrollbars=yes,resizable=yes,height=500,width=800 "); } </script> </HEAD> <BODY> Please select a year to view: <a href="javascript:openResults(2002)">2002</A> <a href="javascript:openResults(2003)">2003</A> <a href="javascript:openResults(2004)">2004</A> </BODY> </HTML> THEN in sample2.pl I'd use the CGI lib to avoid re-inventing the wheel :) and say somethign like: #!/usr/bin/perl -w use strict; use CGI qw/:standard/; my $year = param("year"); print "Content-type: text/html\n\n"; if($year){ print "You've chosen $year"; }else{ print "No year selected!"; } you get the general idea. if you MUST use a form on the first page, the only way I can think of is to use javascript to read each element out of your form and then open your results window and glue the form elements into the query string (URL encoding everything of course). There may be an easier way but I can't think of one. I'd encourage the link approach if you can get away with it. The less form handling you have to do with javascript the better... Finally, if you can manage it, your life would be simpler without using pop-ups for this particular task. good luck -Peter -----Original Message----- From: Stephen Spalding [mailto:[EMAIL PROTECTED]] Sent: Wednesday, February 05, 2003 2:00 PM To: CGI Subject: Variable passing 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] -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]