help with iframes and PHP[unsolved]

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
Charles256
DevNet Resident
Posts: 1375
Joined: Fri Sep 16, 2005 9:06 pm

help with iframes and PHP[unsolved]

Post by Charles256 »

please please please please help...The problem is it's loading the entire main page up inside of the iframe and then making a new iframe..here is the relevant code..if you need to see any other code just let me know and i'll post it asap.
As a side note the link doesn't actually change the URL yet the page changes.. :-/
body.php

Code: Select all

<div id="nav"><a href="index.php?page=testing" target="dc">testing</a></div>
		
	<?php
if (!isset($_REQUEST['page']))
	{
		$_REQUEST['page']="NULL";
	}
	$page=$_REQUEST['page'];
		if ($page=="NULL")
		{
			echo("
			<div id='dlx'></div>
			<div id='banner'></div>
			<div id='grave'></div>
			<div id='defaultbody'>");
			echo("<iframe src='default.php' width='100%' height='120px' scroll='yes' border='0' name='dc'>You need to enable frames to view this site. Thank you.</iframe>");
			echo ("</div>
			<div id='mini'>");
		}
		else
		{
		echo ("<div id='mainbody'>");
		echo ("<iframe src='".$page.".php' width='100%' height='300px' scroll='yes' border='0' name='dc'>You need to enable frames to view this site. Thank you.</iframe>");
		}
	?>
	</div>
testing.php (the page that loads within the iframe making a new iframe..weird..)

Code: Select all

we are testing the power of the code my unfamilair buddy.we are testing the power of the code my unfamilair buddy.we are testing the power of the code my unfamilair buddy.we are testing the power of the code my unfamilair buddy.we are testing the power of the code my unfamilair buddy.we are testing the power of the code my unfamilair buddy.we are testing the power of the code my unfamilair buddy.we are testing the power of the code my unfamilair buddy.we are testing the power of the code my unfamilair buddy.we are testing the power of the code my unfamilair buddy.we are testing the power of the code my unfamilair buddy.we are testing the power of the code my unfamilair buddy.
one last side note if i manually type in index.php?page=testing it works just fine..grrr...
Last edited by Charles256 on Wed Oct 12, 2005 6:53 am, edited 1 time in total.
User avatar
feyd
Neighborhood Spidermoddy
Posts: 31559
Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA

Post by feyd »

is this page set to standards compliance mode?
Charles256
DevNet Resident
Posts: 1375
Joined: Fri Sep 16, 2005 9:06 pm

Post by Charles256 »

Code: Select all

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
  <head>
  <meta http-equiv="content-type" content="text/html; charset=windows-1250">
that give ya the info ya need?
Charles256
DevNet Resident
Posts: 1375
Joined: Fri Sep 16, 2005 9:06 pm

Post by Charles256 »

i've tried changing the doc type but then the rest of my layout messes up:-/ either way the HTML validates with some minor changes..yet still the same problem..
edit: something else that is really odd.. if i type in the addy say http://localhost and then click the link it doesn't work.however if i shift click it it opens in a new windows and from then i can click the links and it displays properly.
edit2:
new code...

Code: Select all

<div id="nav"><a href="index.php?page=testing" target="dc">testing</a>
	<br>
	<a href="index.php?page=NULL" target="dc">Home</a></div>
		
	<?php
	if (!isset($_REQUEST['page']))
	{
		$_REQUEST['page']="NULL";
	}
	$page=$_REQUEST['page'];
		if ($page=="NULL")
		{
			echo("
			<div id='dlx'></div>
			<div id='banner'></div>
			<div id='grave'></div>
			<div id='defaultbody'>");
			echo("<iframe src='default.php' width='100%' height='120px' name='cd'>You need to enable frames to view this site. Thank you.</iframe>");
			echo ("</div>
			<div id='mini'></div>");
		}
		else
		{
		echo ("<div id='mainbody'>");
		echo ("<iframe src='".$page.".php' width='100%' height='300px' name='dc'>You need to enable frames to view this site. Thank you.</iframe></div>");
		}
	?>
it is now loading a new window when i click the link and once it gets in the new window i can go back and forth with the links as if life is grand....why is it opening the new window on the first click?
Charles256
DevNet Resident
Posts: 1375
Joined: Fri Sep 16, 2005 9:06 pm

Post by Charles256 »

anything i can do t omake it clearer?
Post Reply