php and frames help needed

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
nick_m37
Forum Newbie
Posts: 1
Joined: Sun Jun 18, 2006 9:14 pm

php and frames help needed

Post 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?
User avatar
RobertGonzalez
Site Administrator
Posts: 14293
Joined: Tue Sep 09, 2003 6:04 pm
Location: Fremont, CA, USA

Post 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?
Post Reply