Hi, all

I'm working on a website that is comprised of two iframes within several nested divs ( the frames named "frame-menu" and "frame-main"). Displaying as such:

<div id="wrapper">
    <div id="header">Header text/image goes here</div>
    <div id="menu"><iframe name="frame-menu" id="frame-menu" src="menu.php" frameborder="0" height="30"></iframe></div>
    <div id="main"><iframe name="frame-main" id="frame-main" src="login.php" frameborder="0" width="878" height="700"></iframe></div>
    <div id="footer"><A HREF="about.php" TARGET="frame-main">About Us</A> - Contact</div>
    <div id="bottom">&copy;2015</div>
</div>

When the user logs on via the 'login.php' form, I'd like to reload the 'menu.php' file in the 'frame-menu' frame, to run the PHP conditionals to change the "log in" link to a "log out" link. However, I can't figure out a way to get the menu.php file to reload.

I've tried adding headers to the code of beginning of the page that loads after the user logs in...

header('Window-target: frame-menu');
header('Location: https://www.website.com/menu.php');

and had no luck.

I know this can be accomplished via Javascript, but I'm rather hesitant to use it, as users can turn it off, and, well, completely screw up my login process...

Does anyone have any suggestions for me on this?

Thank you!

Recommended Answers

Yes users can turn off JS, but the percentage of them is minutely small these days. They could be thought of a "very edge" cases. So not using JS will tie you to alternatives. iframes are a such a mess. They do not respond well to dynamic content. Their heights …

Jump to Post

All 3 Replies

use sessions to pass a variable from login.php to main.php as a key to determine which button is gonna be shown

Have you tried giving your frame a target of the iframe you want to load the response into? Like this:
<form target="frame-menu">

Member Avatar

Yes users can turn off JS, but the percentage of them is minutely small these days. They could be thought of a "very edge" cases. So not using JS will tie you to alternatives. iframes are a such a mess. They do not respond well to dynamic content. Their heights have to be declared. Urgh. Sounds like a 15-year old workaround. My 2p. I'd certainly rethink this whole approach.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of 1.21 million developers, IT pros, digital marketers, and technology enthusiasts learning and sharing knowledge.