Hello all,

I’m in the process of writing a CGI web page using
perl with some Javascript added (I’m new to
Javascript), and I’ve run into something that seems
simple enough to do but haven’t had much luck with it.

The web page has two radio buttons and a submit button
inside of one form. What I’m trying to do is open a
new window when the user presses the submit button and
have the value of the radio button get passed to the
new window and display it. Here’s the main script:

test1.pl

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

print "<HTML>\n";
print "<TITLE>TEST1</TITLE>\n";
print "<BODY BGCOLOR=\"#ffffff\">\n";

print "<SCRIPT language=\"JavaScript\">\n";
print "function open_new_window()\n";
print "   {\n";
print "   var = open(\"test2.pl\", \"test2\",
\"resizable=yes,height=500,width=600\")\n";
print "   }\n";
print "</SCRIPT>\n";
print "<FORM method=\"post\" action=\"test2.pl\">\n";
print "<TABLE width=\"700\">\n";
print "<TR>\n";
print "  <TD width=\"700\" align=left>\n";
print "    <B><U>Members<U></B>\n";
print "  </TD>\n";
print "</TR>\n";
print "</TABLE>\n";
print "<TABLE width=\"700\">\n";
print "<TR>\n";
print "  <TD width=\"700\" align=left>\n";
print "  <input type=radio name=member value=create>
Create a new member\n";
print "  </TD>\n";
print "</TR>\n";
print "<TR>\n";
print "  <TD width=\"700\" align=left>\n";
print "  <input type=radio name=member value=delete>
Delete a member\n";
print "  </TD>\n";
print "</TR>\n";
print "<TR>\n";
print "  <TD width=\"700\" align=left>\n";
print "  <input type=button name=\"memberbutton\"
value=\"Submit\"";
print "  onClick=\"open_new_window()\">";
print "  </TD>\n";
print "</TR>\n";
print "</TABLE>\n";
print "</FORM>\n";
print "</BODY>\n";
print "</HTML>\n";


Here is the script that it’s calling:

test2.pl

#!/usr/bin/perl
use DBI;
use FileHandle;
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;
        print "name = $name, value = $value\n";
        if ( $name eq 'member' ) { $member_action =
$value; }
        }
print "<HTML>\n";
print "<TITLE>OnCall</TITLE>\n";
print "<BODY BGCOLOR=\"#ffffff\">\n";
print "MEMBER ACTION = $member_action\n";
print "</BODY>\n";
print "</HTML>\n";


Can anyone help me out?

Thanks!

-Stephen Spalding


__________________________________________________
Do You Yahoo!?
Yahoo! - Official partner of 2002 FIFA World Cup
http://fifaworldcup.yahoo.com



_______________________________________________
Redhat-list mailing list
[EMAIL PROTECTED]
https://listman.redhat.com/mailman/listinfo/redhat-list

Reply via email to