kirtok, here is what I understood about your intention, and two solution schemas, where what we discussed before is applied:
fact 1)
you DO have a php script generating the text in the first iframe, so that php script can easily generate the html source of the same text for the second iframe (NO need of javascript code to have that result)
fact 2)
you started using iframes
some browsers don't support them, you know, but they help in building a fixed layout for the webpage
again, iframe requires the content is available through another web address, by definition
then,
solution 1 - don't use iframes, have a layout not fixed
<html>
<body>
<?php
if ($submit) {
$f1 = $_POST['f1'];
$f1 = "<table><tr><td width=50%>".$f1."</td><td width=50%>this is a html text generated by php, based on the user selection</td></tr></table>";
$f1htm = str_replace("<","<",$f1);
}
else {
$f1="Here something will be displayed based on the user selection";
$f1htm="Here will be the html source of what displayed above";
}
?>
<table width="756" height="185" border="0">
<tr>
<td><form method="post" action="<?php echo $PHP_SELF?>" name="form">
<table width="747" border="1">
<tr>
<td width="342">FORM<br>
<input name="f1" type="text" id="f1" /> <br> <input type="submit" name="submit" value="Submit">
</td>
<td width="395"><?php echo $f1 ?> </td>
</tr>
<tr>
<td> </td>
<td width="395"><?php echo $f1htm ?> </td>
</tr>
</table>
</form>
</td>
</tr>
</table>
</body>
</html>
alternatively, solution 2) use iframes, use only one php script
(the php script is used to generate 'on-the-fly' the iframe bodies)
<html>
<body>
<?php
//in this solution the generation of the webpage requires 3 calls to this php script
//one to generate the global page and one for each iframe included
//this script is able to manage some post and get vars
//[post] f1 : the user choice (used generating the global page)
//[get] s : the user choice (used generating the iframe bodies)
//[get] m : the iframe the body is being generated for
if ($_GET['m'] == '') { //generate the global page
if ($submit) $f1 = $_POST['f1'];
if ($f1=="") $f1="null"; //make f1 having a not null value ever
//the user choice is now a php var and will be used in the html below
//to compose a new call to this php script passing the choice as get var
}
else { //generate a html body to be displayed in the single iframe
$f1 = $_GET['s'];
if ($f1=="null") { //no user choice
if ($_GET['m']=='thumbnails') $s="Here something will be displayed based on the user selection. At the moment the selection is null.";
else $s="Here will be the html source of what displayed above";
}
else { //user choise not null
$s = "<table><tr><td width=50%>".$f1."</td><td width=50%>this is a html text generated by php, based on the parameters set in the form</td></tr></table>";
if ($_GET['m']=='viewhtml') $s=str_replace("<","<",$s);
}
echo $s;
exit;
}
//the following html to be used to generate the global page only
//both the two iframes require a new call to this php script
?>
<table width="756" border="0">
<tr>
<td><form method="post" action="<?php echo $PHP_SELF?>" name="form">
<table width="747" border="1">
<tr>
<td width="342">FORM<br>
<input name="f1" type="text" id="f1" /> <br> <input type="submit" name="submit" value="Submit">
</td>
<td width="395">
<iframe name=thumbnails width=395 height=420 frameborder=1 scrolling=auto
src="<?php echo $PHP_SELF.'?s='.$f1.'&m=thumbnails' ?>">No i-frames</iframe>
</td>
</tr>
<tr>
<td> </td>
<td width="395">
<iframe name=viewhtml width=395 height=80 frameborder=1 scrolling=auto
src="<?php echo $PHP_SELF.'?s='.$f1.'&m=viewhtml' ?>">No i-frames</iframe>
</td>
</tr>
</table>
</form>
</td>
</tr>
</table>
</body>
</html>
I suggest to keep it simple, separating the php script generating the webpage from that generating the iframe bodies...
but first of all, I suggest not to use iframes