Forum Moderators: coopster
3 frames, one is a chat frame with a chat script, one is a php form that takes in a URL, and changes the location of the third frame.
frames:
-webpage frame <--this one should change
-php url form frame
-chat frame
the php url form frame should accept a URL and change what is displayed in the webpage frame only.
i am stumped as to how i would do this, and using iframes is out of the question.
the thing i made just ends up that each time you submit a url to the php form script, it breaks the second frame into 2 frames, and that is definitely not what i want.
if there was a way to do this in javascript, would anyone care to tell me how i would do it or what the functions i would use are called?
im thinking i might have to use an iframe for this, despite REALLY not wanting to. if i did it with an iframe i would have a php script that has the form and the iframe in the main frame, and have it change the src="" portion of the iframe. the only problem with this, is that my chat screen is resizeable, and my iframe is not, once you make the iframe you cant resize it, but you can resize the chat frame (like to pull it down if you need room, etc)
frame3 receives the URL variable as part of a form input using GET.
The first thing to do is retrieve the URL
<?
$newURL=$_GET['URL'];//retrieve the URL
?>
Somewhere in the html code of frame3 should be some javascript with a PHP echo of the new URL
<script language='javascript'>
top.frame2.location="<? echo $newURL;?>";
</script>
This leaves a lot of dependancy on the browsers javascript capabilities. You'll want to brush up on javascript frame usage. I believe the following will work as well, but it has been a while since I javascripted some frames.
parent.frame2.document.location.href="<? echo $newURL;?>";
I am making the assumption that the frame structure you have is one along the top, left side, and a main frame for the primary content.
I would do a form in the page in which you are selecting what page you want to jump to. Then use the $_POST to grab your variable. But here is how you do it (to solidify what Jezra said):
$selected_page = $_POST['selected_page'];
$SUBMIT = $_POST['SUBMIT'];
if($SUBMIT)
{ <script language=javascript>
parent.leftFrame.location="menu.php";
parent.mainFrame.location="$selected_page";
</script
}
//HTML part
<html>
<body>
<form method=POST>
// input for name selection (<select> or textbox etc)
<input type=submit name=SUBMIT value="Go to Page">
</form>
</body>
</html>
The leftFrame and mainFrame correspond to the frame name (which you must set in your index page (it is an attribute of <frame> which is inside your <frameset> tags). By the way, you may notice that I do not use generic names like frame1 and frame2 ... be specific (for your own benefit). The example above would affect two frames. You can only affect one at a time if you wish (which is what it sounds like you want to do).
Josh
I have a page with 2 iframes in. Once my php script has process in one of the iframes, I need to re-display the original page. How do I do this without it opening another fresh window (using target=).
Should I be using parent.location= or something similar?
Andrew
<FORM METHOD="POST" ACTION="navform2.php" target="_parent">
the navform2.php page all it does is passes a Header("Location: [#*$!.xxx.xxx.xxx:8088...]
which goes to chatnav, which is the frameset of the viewing window and the navform2 window, and the fact that the navform2 has a target="_parent" (i didnt knowi could do this! took for ever to find this out!) means that what will happen is exactly what i want to happen.
chatnav is a frameset page that can accept a $_GET parameter that is a url and displays that URL in the URL frame that was entered in the navform2 frame, and target=_parent works because the chat frame itself is not overwritten by _parent, so all is well!
if anyone wants my for this if theyre interested gimme a shout