Hi

I have a form on my site that is running in an iFrame called 'content'

When the form is submitted it saves some data into a cookie and then uses header(location) to reload the original home page. (index.php)

The problem is the full site including the iFrame etc are loaded back into 'content' !

Is it possible to use target="self" within header(location) ??
This is what I have so far !!

$host  = $_SERVER['HTTP_HOST'];
$uri   = rtrim(dirname($_SERVER['PHP_SELF']), '/\\');
header("Location: http://$host$uri/index.php");

Any ideas ? Thanks 🙂

    Just in case it helps 🙂
    This is the index.php page:

    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml">
    <head>
    <title>TEST</title>
    <meta http-equiv="Content-Language" content="English" />
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
    <link rel="stylesheet" type="text/css" href="css/style.css" media="screen" />
    </head>
    <body>
    <div id="storage" style="display:none;">
    </div>
    
    <div id="wrap">
    
    <div id="header1">
    <div style="float: right;">
    | <a href="settings.php" target="content">SETTINGS</a> | <a href="index.php">HOME</a> |
    </div>
    PAGE TITLE
    </div>
    <br>
    <div id="left">
    
    <h2><b>Navigation:</b></h2>
    <div class="box">
    <ul>
    <li><a href="menu1.php" target="content">Menu 1</a></li>
    <li><a href="menu2.php" target="content">Menu 2</a></li>
    <li><a href="menu3.php" target="content">Menu 3</a></li>
    <li><a href="menu4.php" target="content">Menu 4</a></li>
    <li><a href="menu5.php" target="content">Menu 5</a></li>
    </ul>
    </div>
    </div>
    
    <div id="content">
    <iframe src="home.html" width="100%" height="100%" frameborder="0" scrolling="auto" name="content"> - 
    </iframe>
    </div>
    
    <div id="footer">
    <div style="float: right;">
     | <a href="mailto:me@domain.com" title="Contact Me"><img src="images/contact.gif" alt="Contact" /></a> |
    </div>
    | Copyright &copy;  |
    </div>
    </div>
    </body>
    </html>

    It's the settings.php page when submitted I want to reload the entire site in the current page, not into the 'content' iframe !

    Thanks 🙂

      you can't with php, you should really drop the use of frames they are depreciated. You can achieve the same effect with ajax.

      looks like your only using a frame to keep the header and footer the same through the site? If so that's a bad idea, use includes instead.

        Thanks for the reply.

        I thought this iframe was being used by the 'content' not the menu, header or footer !

        anyway I've sorted it so it refresh to the correct page.

        Thanks 🙂

          Write a Reply...