Solved

PHP & Iframe passing value

Posted on 2013-01-15
2
426 Views
Last Modified: 2013-01-16
Hi ,
I have a PHP program, inside this php, there is another PHP in iframe

<iframe id="I2"  name="I2"  src="cal_1.php" style="width: 640px">
Your browser does not support inline frames or is currently configured not to display inline frames.
</iframe>

I need to pass a value from this PHP to the one inside frame (cal_1.php).

One method that I could think of was using this in cal_1.php

<input type="submit" name="button2" id="button2" value="Run Report"  onClick="javascript:alert(parent.frames[0].document.getElementById('websiteadress').value);">


but it doesn't get anything , in error console , it says
Type Error parent.frames[0].document.getElementById('websiteadress').value  is null

Any help is appreciated
0
Comment
Question by:fparvini
2 Comments
 
LVL 75

Expert Comment

by:Michel Plungjan
ID: 38780191
You need to rephrase that.

Which php needs to pass what into where?

What is websiteaddress and in which page/php/window does it live?

Never do anything onclick of a submit button and javascript: pseudoprotocol/label is not needed
0
 
LVL 83

Accepted Solution

by:
Dave Baldwin earned 500 total points
ID: 38780377
Just echo it in the tag and it will be a $_GET variable in "cal_1.php".

<iframe id="I2"  name="I2"  src="cal_1.php?name=<?php echo $value; ?>" style="width: 640px">
Your browser does not support inline frames or is currently configured not to display inline frames.
</iframe>

Open in new window

0

Featured Post

3 Use Cases for Connected Systems

Our Dev teams are like yours. They’re continually cranking out code for new features/bugs fixes, testing, deploying, testing some more, responding to production monitoring events and more. It’s complex. So, we thought you’d like to see what’s working for us.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Today, still in the boom of Apple, PC's and products, nearly 50% of the computer users use Windows as graphical operating systems. If you are among those users who love windows, but are grappling to keep the system's hard drive optimized, then you s…
SSL stands for “Secure Sockets Layer” and an SSL certificate is a critical component to keeping your website safe, secured, and compliant. Any ecommerce website must have an SSL certificate to ensure the safe handling of sensitive information like…
This Micro Tutorial will demonstrate how nuggets on the Web are formatted by using Chrome Developer Tools. These tools would not only view the site's CSS but it can also modify it and save the CSS to use on your own site.
Shows how to create a shortcut to site-search Experts Exchange using Google in the Chrome browser. This eliminates the need to type out site:experts-exchange.com whenever you want to search the site. Launch the Search Engine Menu: In chrome, via you…

911 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

17 Experts available now in Live!

Get 1:1 Help Now