Solved

PHP & Iframe passing value

Posted on 2013-01-15
2
429 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

Master Your Team's Linux and Cloud Stack!

The average business loses $13.5M per year to ineffective training (per 1,000 employees). Keep ahead of the competition and combine in-person quality with online cost and flexibility by training with Linux Academy.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
How to specify a browser 14 57
Receipt Printer for web based app 3 65
Parsing an RSS Feed 4 15
Enterprise Mode 4 28
Citrix XenApp, Internet Explorer 11 set to Enterprise Mode and using central hosted sites.xml file.
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…
Learn the basics of if, else, and elif statements in Python 2.7. Use "if" statements to test a specified condition.: The structure of an if statement is as follows: (CODE) Use "else" statements to allow the execution of an alternative, if the …
In this fourth video of the Xpdf series, we discuss and demonstrate the PDFinfo utility, which retrieves the contents of a PDF's Info Dictionary, as well as some other information, including the page count. We show how to isolate the page count in a…

813 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

18 Experts available now in Live!

Get 1:1 Help Now