aviatorisu Posted September 4, 2006 Share Posted September 4, 2006 I'm trying to include an IFRAME on my page. Basically the reason I am using it is to be able to use it as a TARGET for a few links. I'm able to include it and make it work, but when I go to add PHP code to it, the trouble starts. I'm wanting the frame to display a default image based on the ID of the page it is included within. I've done it a few ways, and the best I can figure is that the IFRAME isn't getting the ID data to be able to provide the appropriate variable. If anyone understands what I am saying, am I correct? Is there a way around this??Thanks,~Z~ Quote Link to comment https://forums.phpfreaks.com/topic/19679-iframe-issue/ Share on other sites More sharing options...
.josh Posted September 4, 2006 Share Posted September 4, 2006 care to post some of your code? Quote Link to comment https://forums.phpfreaks.com/topic/19679-iframe-issue/#findComment-85794 Share on other sites More sharing options...
aviatorisu Posted September 4, 2006 Author Share Posted September 4, 2006 The code for my default IFRAME page is:[code]<TABLE CELLPADDING=0 CELLSPACING=0 BORDER=0 ALIGN="CENTER" WIDTH="450" HEIGHT="150"><TR><TD VALIGN="TOP"><IMG SRC='images/<?php echo "$picture1";?>'></TR></TD></TABLE>[/code]The code from the page it is inserted on:[code]<IFRAME BGCOLOR="#000000" SRC="image.php" MARGINWIDTH=0 MARGINHEIGHT=0 FRAMEBORDER=0 SCROLLING=NO WIDTH=450 HEIGHT=100% NAME="IMAGE"></IFRAME>[/code]The variable $picture1 is defined on the page where the IFRAME is inserted.~Z~ Quote Link to comment https://forums.phpfreaks.com/topic/19679-iframe-issue/#findComment-85802 Share on other sites More sharing options...
designationlocutus Posted September 4, 2006 Share Posted September 4, 2006 You could send the name of your image as a url variable when the user clicks on the link, then use the url variable and assign it to picture. Quote Link to comment https://forums.phpfreaks.com/topic/19679-iframe-issue/#findComment-85805 Share on other sites More sharing options...
Daniel0 Posted September 4, 2006 Share Posted September 4, 2006 Put [code]<?php session_start(); ?>[/code] at the top of image.php, then store the variable as a session variable ($_SESSION['picture1']) on the page containing the iframe and call the session variable in image.php. Remember to use session_start() in both pages (before outputting anything). Quote Link to comment https://forums.phpfreaks.com/topic/19679-iframe-issue/#findComment-85806 Share on other sites More sharing options...
aviatorisu Posted September 4, 2006 Author Share Posted September 4, 2006 That's the way I'm doing it, but I need it to load a default image based on the ID of the parent page loaded.~Z~ Quote Link to comment https://forums.phpfreaks.com/topic/19679-iframe-issue/#findComment-85808 Share on other sites More sharing options...
Daniel0 Posted September 4, 2006 Share Posted September 4, 2006 Actually you didn't. Quote Link to comment https://forums.phpfreaks.com/topic/19679-iframe-issue/#findComment-85809 Share on other sites More sharing options...
aviatorisu Posted September 4, 2006 Author Share Posted September 4, 2006 sorry, that reply wasn't for you, it was for designationlocutus. I'm trying your suggestion now.I'm a little fuzzy about how to include the session variable ($_SESSION['picture1']) though, could you help with that? Quote Link to comment https://forums.phpfreaks.com/topic/19679-iframe-issue/#findComment-85811 Share on other sites More sharing options...
aviatorisu Posted September 4, 2006 Author Share Posted September 4, 2006 Anyone else have any thoughts??~Z~ Quote Link to comment https://forums.phpfreaks.com/topic/19679-iframe-issue/#findComment-85858 Share on other sites More sharing options...
designationlocutus Posted September 7, 2006 Share Posted September 7, 2006 Session would be useful if you wanted to maintain the image through several clicks. Start the session the way Daniel suggested (this must be done on every page that you use) and assign your session variable to the picture name. However to do it the way I suggested, you need to set the iframe src in your second example to produce the correct image. [code]SRC="image.php?picture1=image.jpg"[/code] Quote Link to comment https://forums.phpfreaks.com/topic/19679-iframe-issue/#findComment-87787 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.