xagutxu Posted May 17, 2011 Share Posted May 17, 2011 Hello: I have bought a code for a chat script, and I have some problems making the changes I need. One of them is that I have to pass some variables to an iframe. The iframe is created by javascript, when an icon is clicked: document.getElementById('xxx').innerHTML='<iframe src="phpscript.php" scrolling="no" frameborder="0" style="margin:0px;padding:0px;width:400px;height:260px;border-width:0px;overflow:hidden"></iframe>'; I would like to know whether the variables can be passed using the url (via GET) or not. In case I cannot, which other method can I use to pass variables to an iframe? Or, maybe, is better using global variables...? Thank you, Xagutxu Link to comment https://forums.phpfreaks.com/topic/236687-passing-variables-to-a-iframe/ Share on other sites More sharing options...
The Letter E Posted May 17, 2011 Share Posted May 17, 2011 <iframe src="myurl.php?var1=foo&var2=bar"></iframe> in the frame: (myurl.php) <?php $myVar1 = $_GET['var1']; $myVar2 = $_GET['var2']; echo $myVar1.$myVar2; //foobar ?> Link to comment https://forums.phpfreaks.com/topic/236687-passing-variables-to-a-iframe/#findComment-1216739 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.