0

I need to do when a link is clicked then it is opened in same frame where from it is opened.

Means, I have index.php file and it has one iframe FrameLoader

<div class='iframebox'>
<?php
if(empty($_GET['p'])){
   $_SESSION['iFrameLoader']='home.php';
}else{
   $_SESSION['iFrameLoader']=$_GET['p'].".php";
}
?>
    <iframe src="<?php echo $_SESSION['iFrameLoader']; ?>" name="iFrameLocate" id="iFrameLocate"></iframe>
    </div>

And there is three other php files, home.php, demo1.php and demo2.php

home.php

<h1>This is home page for demo</h1>
<a href='index.php?p=demo1'>Page 1</a>
<a href='index.php?p=demo2'>Page 2</a>

It open in same frame but also create index.php inside of index.php. so how to fix this for open in same frame other sub pages and with similar layouts.

  • Maybe you can try this: [How to force link from iframe to be opened in the parent window](http://stackoverflow.com/questions/1037839/how-to-force-link-from-iframe-to-be-opened-in-the-parent-window) – shaggy Mar 05 '17 at 10:11

1 Answers1

0

I would personally avoid using iframe. Good Reasons why not to use Iframes in page content

Community
  • 1
  • 1
Marcin Restel
  • 280
  • 3
  • 13