I think your problem might be with what HTML you are returning to the browser. But I am not very sure, since you logic was unclear to me. I had to rewrite some of this for my own sanity, so I hope you forgive me. This script will produce the frameset and each frame. All you need is this script and the coord.dat in the same directory. It uses the 'PATH_INFO' varaible for figuring out which page to print.
#!/acclib/perl5/bin/perl my $path = $ENV{'PATH_INFO'}; my $file = 'coord.dat'; # Name the file print "Content-type: text/html\n\n"; #if no path print the frameset if( $path !~ /\S/ ) { print_frameset(); } #if script called with "/entry" appended then print the #left frame and parse the posted data elsif( $path =~ /entry/ ) { parse_form(); print_entry(); } #if script called with "/coord" appended then print the #right frame elsif( $path =~ /coord/ ) { print_coord(); } exit; sub parse_form { $buffer = 0; read (STDIN, $buffer, $ENV{'CONTENT_LENGTH'}); @pairs = split(/&/, $buffer); # needed to convert from HTML receive foreach $pair (@pairs) { ($name, $value) = split(/=/,$pair); $value =~ tr/+/ /; $value =~ s/%([a-fA-F0-9][a-fA-F0-9])/pack("C",hex($1))/eg; $FORM{$name} = $value; } #print data to file only if both fields were populated if( $FORM{'source'} =~ /\S/ && $FORM{'dest'} =~ /\S/ ) { open(FILE, ">>$file" ) || die; # Open the file for writing ( +append) print FILE "$FORM{source} - $FORM{dest}\n"; close FILE; } } sub print_frameset { print "<html>\n <head>\n"; print "<title>Match Results Thus Far</title>\n</head>\n"; print "<FRAMESET COLS=\"500,*\">\n"; print "<FRAME SRC=\"$ENV{'SCRIPT_NAME'}/entry\" NAME=\"left\" NORE +SIZE>\n"; print "<FRAME SRC=\"$ENV{'SCRIPT_NAME'}/coord\" NAME=\"right\" NOR +ESIZE>\n"; print "</FRAMESET>\n"; print "<body>\n"; print "<hr size=5 width=90%>\n"; print "<ul>\n"; print "\n$buffer\n"; print "<p>Script written by Neil Gaffin\n"; print "</body> </html>\n"; } sub print_coord { print "<html>\n <head>\n"; print "<title>Match Results Thus Far</title>\n"; print "<META HTTP-EQUIV=\"Refresh\" CONTENT=\"5\" URL=\"$ENV{'SCRIPT_NAME'}/coord\" TARGET=\"right\">\n</head>\n"; print "<body>\n<h5>\n"; $lc = 0; open FILE, "$file"; my @lines = <FILE>; close FILE; while (@lines) { $lc += 1; print "<center> $lc -- $lines[0] </center>\n"; shift (@lines); } print "</h5>\n"; print "</body> </html>\n"; } sub print_entry { print "<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 3.2//EN\">\n"; print "<html>\n <head>\n"; print "<title>Neil's Script - Search Engine</title>\n</head>\n"; print "<body bgcolor=#FFFFFF text=#000000> <center>\n"; print "<h2>Move Database Page - File I/O</h2>\n </center>\n"; print "Use the form below to enter moves<br> \n"; print "Enter moves in format:<p>\n"; print "Source Space: Row,Col<br>\n"; print "Dest Space: Row,Col<p>\n"; print "Example: A8, H1, C5, G3<br>\n"; print "(Row must be A-H, Col must be 1-8<p>\n"; print "<hr size=7 width=90%><p>\n"; print "<FORM Action=\"$ENV{'SCRIPT_NAME'}/entry\" METHOD=\"POST\" target = \"left\" >\n"; print "<center><table border>\n <tr>"; print "<td>Source Space: </td><td> <input type=text name=\"source\" size=4><br></td>\n </tr><t +r>\n"; print "<td>Destination Space: </td><td> <input type=text name=\"dest\" size=4><br></td>\n </tr><tr>\ +n"; print "<th colspan=2><input type=submit value=\"Done!\"> <input type=reset><br></th>\n"; print "</tr></table></center></form>\n"; print "<hr size=7 width=90%><p>\n </body></html>\n"; }
This code does not stack up the frames like yours does. Just save it as your fram.cgi and call it from you web browser. It worked for me. The path_info routing I found extremely useful when generating frames form a perl script, and I found it in the CGI.pm manual. You should probably upgrade this to use CGI.pm, it is much easier.

Well I hope I have helped somewhat.

In reply to Re: Big mess (.cgi/ HTML frames question) by perlmonkey
in thread a big mess... (.cgi / frames question) by Konda

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.