main page; index.php
There are two iframe in main page as
iframe name= topifrm
iframe name= content
I want to click on link "Education", then the following action should happen:
load topindex.php page to the topifrm and at the same time load education.php page to the content
or
if you kindly please send me how do I access to php variable, say "$edu_id" in education.php
from topindex.php
page..
I have to say that there a lot of problems in what you are requesting. For a first, don't use IFrames. They were used like that ages ago and thankfully, things like ajax arrived.
The other problem is :
if you kindly please send me how do I access to php variable, say "$edu_id" in education.php from topindex.php page..
Have in mind that PHP
scripts are executed on the server and not in the browser. For that reason, whatever you see in the browser is a strict html file. To make it clear, you can't have access to the php variables from the browser. But it's not the end! Because many people do what you're trying to do but in a better way.
Let say you index.php that return this:
<html>
<head><title></title></body>
<body>
<div id="menu">
<ul>
<li><a data-phpid="education">Education</a></li>
</ul>
</div>
<div id="container"></div>
</body>
</html>
You'll need some javascript because without javascript, it's not really possible to do it correctly with iframes. With iframes, you can't really just get "data" or catch exceptions if the page fails to load.
I'll be using jQuery as everyone uses it and it might be easier to understand because it's not a so bad library. Put this is a script tags after you linked jquery and it should work.
$(function () {
// this will get executed when document is ready
$('#container').load("/secondframe.php");
$('#menu a').click(function() {
var pageid = $(this).data('phpid');
$("#container").load("/secondframe.php?phpid=" + pageid);
});
});
That said, it should work, in your php script you'll be checking for $_GET['pageid']
to get the id you just sent as "get" params.
But If I were you, I wouldn't use load but instead serialize everything to json, pass the json to a Javacript object to generate html on the browser instead of rendering html on the server. Leave php as it will never give you anything good but only nightmares.
Learn javascript! Learn it well don't use jQuery (jquery will prevent you from understanding how to write code in javascript). Learn python to write application server, learn ruby and don't restrict yourself to rails. And learn a lisp because real programmer program with lambda calculus!