prudens Posted June 13, 2008 Share Posted June 13, 2008 hi, I want to pass a few variables $var1 $var2 to iframe.php in IFRAME from MAIN. And I want iframe.php to read the $var1, $var2 and then send back $var3, $var4 to MAIN. How do I do it? Thanks! Quote Link to comment Share on other sites More sharing options...
bluejay002 Posted June 13, 2008 Share Posted June 13, 2008 well you can pass value to the script inside iframe through $_GET, $_SESSION... if you are calling things inside iframe on the client side, then you can use DOM. passing variables back to main can be done using $_SESSION but i dont think this can be read from the client-side so you can use DOM here also. Quote Link to comment Share on other sites More sharing options...
csteiner27 Posted July 8, 2008 Share Posted July 8, 2008 I have similar issue. I need to "pull variables" from the parent page on my child page so I can use it in several places on the child page I am dynamically calling iframes so can't use the GET Here is what I have in the parent <script type="text/javascript">function populate(){ top.frames['frame1'].document.form2.from.value = '$email'; top.frames['frame1'].document.form2.name.value = '$fname $lname'; } </script> That works before if the child page is "Form" as it sets the values. But I have children pages that are just text and I want to be able to use the NAME within the text on the child page. "$FNAME $LNAME, thanks for visiting..." Quote Link to comment Share on other sites More sharing options...
discomatt Posted July 8, 2008 Share Posted July 8, 2008 I don't see why you can't use GET on dynamic child pages :S Quote Link to comment Share on other sites More sharing options...
bluejay002 Posted July 9, 2008 Share Posted July 9, 2008 You can actually use $_GET for that... I have been doing that several times on mine... even changing the content iframe with different scripts. $_GET works for me though. Why not yours? Quote Link to comment Share on other sites More sharing options...
Guest Xanza Posted July 9, 2008 Share Posted July 9, 2008 Use sessions... You'll be able to continue the session into the iframes and grab your needed variable data that way. Quote Link to comment Share on other sites More sharing options...
bluejay002 Posted July 9, 2008 Share Posted July 9, 2008 Yep... use $_SESSION for globally indicated variables. But for content specific values... which is retrievable using JavaScript and cannot be identified when the page is loaded, use $_GET. Quote Link to comment 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.