View Full Version : dynamic iframes?
10-08-2009, 04:59 PM
I simply want to install iframes on my popup windows that will display my php form/table app. The issue I'm having is that the iframe url will vary depending on the user logged in as the app is pulled from that user's directory. So instead of a nice clean url it has to be something like this "http://www.mysite.com/directory1/directory2/" . $User ."/app.php"
I'm sure whatever needs to be done here is simple enough, but after scouring all the forums and how-to articles I have since spent the great deal of my time pulling out my hair. I am now bald and looking for someone to bail me out, I just have no idea how to put this code all together.
Any help would be greatly appreciated! An actual working code would be beyond excellent! Thank you so much in advance!
if you're using php already, do you really need iframes? Just write your dynamic url in the popup link and open the desired page directly:
<a href="http://www.tosengine.com/NFDocuments/AS9100/<?php echo $User; ?>/app.php">popup link</a>
10-08-2009, 07:45 PM
Thanks for your reply! That's definitely a way of going a way of going about it! I think I just got hung up trying to do the iframes because I wanted to have some display properties that would be easily achieved by doing it that way. But now that you mention it, with this iframe issue giving me such a headache, it may be easier to set it up your way.
I'm a bit knew to PHP (if you can't tell) so your help in this is really appreciated!
if you're really set on using iframes (and I don't recommend it - they're a pain and accomplish nothing you can't do through php and css), I think it could work like this:
<?php session_start(); // this line MUST be the first line on the page! NOTHING above it!
$_SESSION['user'] = $user; //set $user info from this page to be available to session, if not already done
<a href="/path/to/popup.php">popup link</a>
<?php session_start(); //see comment above
<iframe src="http://www.tosengine.com/NFDocuments/AS9100/<?php echo $_SESSION['user']; ?>/app.php"></iframe>
this could also be done through $_GET or $_POST, but I think $_SESSION would be best in this case, as user information is usually useful/needed across several pages anyway.
10-08-2009, 08:50 PM
Yeah, I know the iframes are a pain and I think I will try to work around it as you suggest know that I think about it.
Still, thank you very much for going ahead and giving me the iframe too so I can always do it the way I was planning if I need to!
no problem; it should work fine but it's not tested. never done it that way before.
Powered by vBulletin® Version 4.2.0 Copyright © 2013 vBulletin Solutions, Inc. All rights reserved.