Hi,

I have installed ActivePerl-5_6_1_631 and Web server Apach_1.3.22. I am using HTML Frameset in PERL/CGI. Facing problem in displaying HTML Frameset. Please check my coding..


Sample.cgi

#!c:/perl/bin/perl
use CGI qw(:all);
$login=uc(param('uid'));
$passwd=param('pwd');

$kid = time;
$cookie = cookie(-name=>'logtime',
        -value=>$kid,
        -path=>'/cgi-bin/');
if ($login eq "" || $passwd eq "")
{
	print "Content-type: text/html\n\n";
	print "<body bgcolor=\"#ffcccc\">";
	print "<h2>Please enter your userid and password</h2>";
	print "<hr>";
}
else
{
	use DBI;
	my $dbh = DBI->connect("DBI:ODBC:datasource","root","password")
			or die "Can not connect: $DBI::errstr\n"; 
        $sth = $dbh->prepare("select rollno,passwd from table where rollno=\'$login\' ") or die "Can not prepare SQL statement: $DBI::errstr\n"; 
        $sth->execute or die "Can not execute SQL statement: $DBI::errstr\n";
        @ary = $sth->fetchrow_array();
        while(substr($ary[1],length($ary[1]) - 1,1) eq ' '){ $ary[1] = substr($ary[1],0,length($ary[1])-2)};
        if ($passwd eq $ary[1])
        {
                $sth = $dbh->prepare("update table set kid = ? where rollno = ?") or die "Can not prepare SQL statement: $DBI::errstr\n"; 
                $sth->execute($kid,$login) or die "Can not execute SQL statement: $DBI::errstr\n"; 
                print header(-cookie=>$cookie);
                [B]print "Content-type: text/html\n\n";
[/B]
                print "<HTML>";
                print "<HEAD>";
                print "<TITLE>Student page</TITLE>";
                print "</HEAD>";
                print "<Frameset ROWS='21,78'>";
                print "<FRAME SRC=/cgi-bin/title.cgi>";
                print "<FRAMESET COLS='170,*'>";
                print "<FRAME SRC=/cgi-bin/auth/studopts2.cgi >";
                print "<FRAME SRC=/cgi-bin/auth/studopts1.cgi name=dynamic>";
                print "</FRAMESET>";
                print "</Frameset>";
                print "h";
                print "</HTML>";
        }
        else
        {
                print "Content-type: text/html\n\n";
                print "<body bgcolor=\"#ffcccc\">";
                print "<h2>Invalid Attempt!</h2>\n";
                print "<hr>";
        }
	$dbh->disconnect;
}

title.cgi

#!c:/perl/bin/perl
use CGI qw(:all);

print "Content-type: text/html\n\n";

print "<HTML>";
print "<BODY>";
print "<img src=/icons/header.jpg height=100px>";
print "</BODY>";
print "</HTML>";

When i run sample.cgi program in my web server Apache, i am getting only the following output in the plain browser as:
Content-type: text/html\n\n
hi

I did not get any frames.

I don't know, why my HTML Frameset is not working it out. Trying, lot things to fix it out, but can't able to solve this problem. My work gets stopped :(. Please help me out. Thanks in advance

My first advice is to check your Apache error logs to see if the script is even finding the SRCs being called for in your frames. I have a hunch it's. Your html is running - but if your paths to the other scripts and graphics are wrong...

The logs will also tell you if anything else is misfiring.

Edited 5 Years Ago by Dandello: n/a

This article has been dead for over six months. Start a new discussion instead.