Solved

PHP & Iframe passing value

Posted on 2013-01-15
2
432 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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

Why You Need a DevOps Toolchain

IT needs to deliver services with more agility and velocity. IT must roll out application features and innovations faster to keep up with customer demands, which is where a DevOps toolchain steps in. View the infographic to see why you need a DevOps toolchain.

Question has a verified solution.

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

A quick Powershell script I wrote to find old program installations and check versions of a specific file across the network.
The Windows functions GetTickCount and timeGetTime retrieve the number of milliseconds since the system was started. However, the value is stored in a DWORD, which means that it wraps around to zero every 49.7 days. This article shows how to solve t…
Google currently has a new report that is in beta and coming soon to Webmaster Tool accounts. This Micro Tutorial will highlight new features for Google Webmaster Tools.
How to create a custom search shortcut to site-search Experts Exchange using Google in the Firefox browser. This eliminates the need to type out site:experts-exchange.com whenever you want to search the site. Launch your Bookmark Menu: Press 'Ctrl +…

734 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