Page 1 of 1

php and frames help needed

Posted: Sun Jun 18, 2006 9:16 pm
by nick_m37
I am having a problem getting a php script running from a child frame to be able to access another child frame from that script file. The code is as follows;

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html>
<head>
<title>set</title>
</head>
<frameset rows="50%,50%">
<frame name="upper" src="upper.html">
<frame name="lower" src="http://localhost/test/lower.php">
</frameset>"
</html>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html>
<head>
<title>upper</title>
</head>
<body>
<P>upper</p>
</body>
</html>

<html>
<head>
<title>lower</title>
</head>
<body>
<?php
print("lower<br>\n");
print("<script language=\"JavaScript\">\n");
print("document.write(parent.frames.length);\n");
print("var NewDoc = parent.frames[\"upper\"].document.open(\"text/html\", \"replace\");\n");
print("NewDoc.writeln(\"test2\");\n");
print("NewDoc.close();\n");
print("</script>\n");
?>
</body>
</html>

I am wondering if there is any advice to be given becasue the php file gets an access denied error and the javascript declaration print line. I do not know what else to do to get the php file to access the other child frame?

Posted: Sun Jun 18, 2006 9:32 pm
by RobertGonzalez
First off, wrap all PHP code in [ php ][ /php ] or [ syntax="php" ][ /syntax ] (without the spaces to the sides of the brackets) BBCode tags. It makes it a lot easier to read your code.

Second, can you reference the source file using a relative path instead of a full URL?