spires Posted May 23, 2007 Share Posted May 23, 2007 Hi I know this is a javascript based question, but as its passing PHP the javascript guys don't seem to know to do it. Can ou help. I'm having trouble passing PHP varables from outside the Iframe to inside the Iframe. this is what i'm trying at the moment: main page <iframe src="listings_text.php?time_frame=this" NAME="ishort" width="385" height="290"> </iframe> I was thinking it would be something like this, but this is not working. <?php $time_frame = 'this'; ?> <iframe src="<?php echo 'listings_text.php?time_frame='.$time_frame.''; ?>" NAME="ishort" width="385" height="290"> </iframe> This is the page that the Iframe links to, This is where i'm trying to get the variable. <?php $time_frame = $_GET['time_frame']; echo $time_frame; ?> I hope this makes sence, Thank you for helping. Quote Link to comment https://forums.phpfreaks.com/topic/52725-passing-php-variables-through-javascript/ Share on other sites More sharing options...
per1os Posted May 23, 2007 Share Posted May 23, 2007 Have you viewed the source to make sure that the echo is printing everything it should be, and have you also checked that iframe's allow this type of url to be passed with GET data? Have you also checked that the listings_text.php is in the same directory and does not require the first initial http:// part. Try it with the full url in the SRC, http:// and all. see what happends. Quote Link to comment https://forums.phpfreaks.com/topic/52725-passing-php-variables-through-javascript/#findComment-260306 Share on other sites More sharing options...
spires Posted May 23, 2007 Author Share Posted May 23, 2007 HI Thanks for replying, I just tried the full URL but its still going through. I'm not to sure if Iframes will pass GET variable in this way, But, i'm not to sure how else you would do it. Here is the URL i'm working on. http://www.telegraphlondon.co.uk/list_upload.php The right Iframe should be echoing 1 Any more ideas would be great. Thanks Quote Link to comment https://forums.phpfreaks.com/topic/52725-passing-php-variables-through-javascript/#findComment-260313 Share on other sites More sharing options...
per1os Posted May 23, 2007 Share Posted May 23, 2007 You can do it with javascript by setting the variable you want to be passed on the page inside of a form as an input hidden type and on page load you push that variable by getting it by id to the iframe. I am not a javascript guru just know the basics etc, but yea. It is possible, just not 100% clear on how to do it. Quote Link to comment https://forums.phpfreaks.com/topic/52725-passing-php-variables-through-javascript/#findComment-260319 Share on other sites More sharing options...
spires Posted May 23, 2007 Author Share Posted May 23, 2007 OK, Thanks I'll try and look into it. Quote Link to comment https://forums.phpfreaks.com/topic/52725-passing-php-variables-through-javascript/#findComment-260328 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.