...

View Full Version : Iframe - I need to refresh outer frame from inner frame



JimM
02-25-2008, 04:23 AM
I'm using an Iframe layout and need to refresh main outer (parent) page after doing some processing (i.e. if some one clicks on submit in the set_nav.php page I need to refresh the main page so nav reflects the changes entered).
and I'm not sure how to do it and haven't, found a solution searching. I'm guessing that I need to put something in the set_nav.php page to cause sat.php to reload at line 39 rather then setting mode = 0. Also am trying to set it up so set_nav.php stay loaded in the Iframe.

below is the code for the main page sat.php (the outer/parent iframe, the one I need to refresh).



<?php
session_start();
include_once("includes/sat_common.inc");
// Security Check
include ("sec_check.inc");
// Open DataBase connection
include ('DB/initialize.inc');
// Get Site Parameters
require_once('site_globals.inc');
?>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
"http://www.w3.org/TR/html4/strict.dtd">
<html lang="en">
<head>
<title>// Site Admin Tool // <?php echo sitename; ?> //</title>
<?php include_once("includes/meta_tags.inc"); ?>
<link href="stylesheets/main.css" rel="stylesheet" type="text/css" media="screen">
<!--[if IE 6]> <link href="stylesheets/main-IE.css" rel="stylesheet" type="text/css" media="screen"> <![endif]-->
<script type="text/javascript" src="scripts/common.js"></script>
</head>
<body>
<div id="header">
<?php include'header.inc';?>
</div>
<div id="content">
<iframe name="ifrm" id="ifrm" src="modules/section_info.php?section=Home" width="720" height="1" scrolling="no" frameborder="0">Sorry, your browser doesn't support iframes.</iframe>
</div>
<div id="sidebar">
<?php include'nav.inc';?>
</div>
<div id="footer">
<?php include_once'footer.inc';?>
</div>
</body>
</html>


set_nav.php


<?php
session_start();
include_once("../includes/sat_common.inc");
// Security Check
include ("sec_check.inc");
// Open DataBase connection
include ('DB/initialize.inc');
// Get Site Parameters
include_once('site_globals.inc');
include_once('fckeditor/fckeditor_php5.php');
// Global Variable Setup
if (isset($_GET['SectionTitle'])) {
$_SESSION['SectionTitle'] = $_GET['SectionTitle'];
$_SESSION['Table'] = $_GET['Table'];
$_SESSION['SortField'] = $_GET['SortField'];
$_SESSION['SectionName'] = $_GET['SectionName'];
$_SESSION['HelpSegment'] = $_GET['HelpSegment'];
}
$var_SectionTitle = $_SESSION['SectionTitle'];
$var_DBTableName = $_SESSION['Table'];
$var_SortField = $_SESSION['SortField'];
$var_SectionName = $_SESSION['SectionName'];
$var_HelpSegment = $_SESSION['HelpSegment'];
$var_message = 'Select a '.$var_SectionTitle.' or Add a new '.$var_SectionTitle.'.';
// SETUP OF CLASS AND LIST FIELDS IN TABLE
$DataItems = new Data($var_DBTableName);
$fields = $DataItems->getFields();

// SQL/CLASS Functions (Form Processing sections (Add/Insert, Modify/Edit, Delete))
if (isset($_REQUEST['EditSave'])) {
$i=0;
foreach($_POST as $key => $value){
$id = (int) trim($key);
$field_id = array('ID'=>$id);
$DataItems->updateData(array('section_active'), array('section_active'=>$value), $field_id);
// logEntry($var_SectionName, 'Mod - ('.$_REQUEST[$_REQUEST['logname']].')');
}
$var_message = $i." -- ".$var_section_name." Records had there INCLUDE status changed.";
$mode = 0;
}

if ($mode == 0) {
// SQL/CLASS FUNCTIONS TO LIST ALL RECORDS
if ( $var_SortField == '' ) {
$data_all = $DataItems->getAllData($fields);
} else {
$data_all = $DataItems->getAllData($fields, array(), array('section_no'=>'ASC', 'display_order'=>'ASC') );
}
$loop = $DataItems->getTotalData();
}
?>
<!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>// Site Management System - Menu // <?php echo sitename; ?> //</title>
<?php include_once("meta_tags.inc"); ?>
<link href="../stylesheets/maint_pages.css" rel="stylesheet" type="text/css" media="screen" />
<!--[if IE]> <link href="../stylesheets/maint_pages-IE.css" rel="stylesheet" type="text/css" media="screen" /> <![endif]-->
<link rel=stylesheet href="../stylesheets/ds_main.css" type="text/css">
<script type="text/javascript" src="../scripts/common.js"></script>
</head>

<body onLoad="goSetHeight()">
<div id="container">
<input class="btnCenter-red helpbtn" type="button" value="Help" onclick="this.blur();popItOpen('help.php?topic=full','HelpWindow',600,600);" />
<h1><?php echo $var_SectionTitle; ?></h1>
<hr />
<br />
<?php if ($mode == 0) { ?>
<!-- Show Record List (Menu Section Record Selection Page) -->
<h2>List View</h2>
<form action="<?php echo $_SERVER['PHP_SELF'] ?>" method="post">
<table border="1" cellpadding="4" cellspacing="0" width="700">
<tr><td colspan="2" class="msgblock"><?php echo $var_message; ?></td></tr>
<tr id="header">
<th width="90">Active</th>
<th width="605">Module Name</th>
</tr>
<?php if ($loop > 0) { for ($i=0; $i<$loop; $i++) { ?>
<tr>
<td align="center" width="90">
<select class="text_update" name="<?php echo $data_all[$i]['ID']; ?>" id="<?php echo $data_all[$i]['ID']; ?>">
<option value="Y"<?php echo ($data_all[$i]['section_active'] == "Y" ? ' SELECTED' : ''); ?>>Yes</option>
<option value="N"<?php echo ($data_all[$i]['section_active'] == "N" ? ' SELECTED' : ''); ?>>No</option>
</select>
</td>
<td class="text_display" width="605"><?php echo $data_all[$i]['section_title']; ?></td>
</tr>
<?php } } ?>
</table>
<div id="ButtonArea">
<input class="btnCenter" type="submit" name="EditSave" id="EditSave" value="Save" />
<input class="btnCenter-red" type="button" value="Help" onclick="this.blur();popItOpen('help.php?topic=<?php echo $var_HelpSegment; ?>','HelpWindow',600,600);" />
</div>
</form>
<?php } else { ?>
<p>There was some type of error please</p>
<?php } ?>



Thanks.



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum