magic2goodil Posted January 6, 2007 Share Posted January 6, 2007 Hey, sorry if this question has been asked before.I have been using get variables to load a portion of my site and using an array to define only certain ones that can be loaded for security reasons, but that is besides the point.Recently when I added something new to my site, I realized my CSS was being a bastard and wouldn't bump my footer down unless I had something static on the page to bump it. So I added an iframe, php echo"<iframe src=\" " . $var . ".php\"></iframe>"; instead of the php include($var . '.php'); that i had been using. The problem with this that I am having, is that the new page that I added and probably the most important part of the site I am creating, relies on $_GET variables from the browser. I did a test when my page started coming up blank in the iframe and added another case to my switch statement inside the page being loaded in the iframe to test and see if the GET vars were coming up empty, and sure enough they are.I was thinking about pulling in from the address bar on the main page and creating session vars, but that is some annoying recoding I will have to do as well as adding variables that don't exist if the iframe is loaded as any page besides this particular search page. Is there a way to directly call GET variables from my address bar into the iframe. Suggestions in PHP and Javascript are welcome.Thanks, magic2goodil Link to comment https://forums.phpfreaks.com/topic/33149-solved-receiving-variables-from-address-bar-in-iframe/ Share on other sites More sharing options...
dpabla Posted January 6, 2007 Share Posted January 6, 2007 I have an IFRAME setup and you can do the following:The file that holds an iframe: index.php looks like this <td><IFRAME SRC="blank_page.php" name="content" WIDTH=550 HEIGHT=500 SCROLLING=YES></IFRAME></td>Your passingvariables.php looks like this:[code]<?php$result = mysql_query("select * from vendors");while($r=mysql_fetch_array($result)){$vid=$r["vendor_id"];$vendorname=$r["vendor_name"];echo "<a href='page2.php?vid=" . $vid . "' target='content'>" . $vendorname . "</a>";echo "</tr></td>";}?>[/code]Notice the "target" - now anything you pass from here on out, goes to the "content" automatically and your still able to pass variables....hope that helps...[quote author=magic2goodil link=topic=121306.msg498421#msg498421 date=1168121574]Hey, sorry if this question has been asked before.I have been using get variables to load a portion of my site and using an array to define only certain ones that can be loaded for security reasons, but that is besides the point.Recently when I added something new to my site, I realized my CSS was being a bastard and wouldn't bump my footer down unless I had something static on the page to bump it. So I added an iframe, php echo"<iframe src=\" " . $var . ".php\"></iframe>"; instead of the php include($var . '.php'); that i had been using. The problem with this that I am having, is that the new page that I added and probably the most important part of the site I am creating, relies on $_GET variables from the browser. I did a test when my page started coming up blank in the iframe and added another case to my switch statement inside the page being loaded in the iframe to test and see if the GET vars were coming up empty, and sure enough they are.I was thinking about pulling in from the address bar on the main page and creating session vars, but that is some annoying recoding I will have to do as well as adding variables that don't exist if the iframe is loaded as any page besides this particular search page. Is there a way to directly call GET variables from my address bar into the iframe. Suggestions in PHP and Javascript are welcome.Thanks, magic2goodil[/quote] Link to comment https://forums.phpfreaks.com/topic/33149-solved-receiving-variables-from-address-bar-in-iframe/#findComment-154521 Share on other sites More sharing options...
magic2goodil Posted January 6, 2007 Author Share Posted January 6, 2007 Although I do appreciate the attempt at helping, I don't believe that is the correct solution.You are pulling results from a mysql db in your example, whereas i am not wishing to store anything in a db to be called later to my page. The reasoning behind get vars is to allow advanced users to easily alter the address bar for new searches as well as simplicity of pulling vars from the address bar.I am currently working on creating a searchObject class to pull in the vars from the address bar on the original page so that they can be used on the iframe. I am hoping there is something simpler for this though.Any more suggestions would be appreciated. Link to comment https://forums.phpfreaks.com/topic/33149-solved-receiving-variables-from-address-bar-in-iframe/#findComment-154532 Share on other sites More sharing options...
magic2goodil Posted January 7, 2007 Author Share Posted January 7, 2007 blah, i guess i am going to have to fix this problem myself..tell you all what, i will write this class so that it can be sued by more than just myself and give it out..we shall call it iframeAddressBarReader or something, lol :) Link to comment https://forums.phpfreaks.com/topic/33149-solved-receiving-variables-from-address-bar-in-iframe/#findComment-154599 Share on other sites More sharing options...
magic2goodil Posted January 7, 2007 Author Share Posted January 7, 2007 When i finish writing this code, I will post a link for anyone who desires it in the future.Nice to solve my own problem :) Link to comment https://forums.phpfreaks.com/topic/33149-solved-receiving-variables-from-address-bar-in-iframe/#findComment-154664 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.