Solved

PHP & Iframe passing value

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

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

Top 6 Sources for Identifying Threat Actor TTPs

Understanding your enemy is essential. These six sources will help you identify the most popular threat actor tactics, techniques, and procedures (TTPs).

Join & Write a Comment

It is a general practice to get rid of old user profiles on a computer  in a LAN environment. As I have been working with a company in a LAN environment where users move from one place to some other place at times. This will make many user profil…
This article is meant to give a basic understanding of how to use R Sweave as a way to merge LaTeX and R code seamlessly into one presentable document.
Learn the basics of lists in Python. Lists, as their name suggests, are a means for ordering and storing values. : Lists are declared using brackets; for example: t = [1, 2, 3]: Lists may contain a mix of data types; for example: t = ['string', 1, T…
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 +…

706 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