1

I created iframe where source is my PHP file, the file should display data from GET method the code is:

<?php   
if (isset($_GET["phpMap"])){
var $response = $_GET["phpMap"];
echo $response;
}
?>

but when i run button that send data to that iframe nothing happens.

4 Answers 4

3

Plz correct your code as follow, remove "var"

<iframe src="iframe.php?phpMap='google'" ></iframe>

in iframe.php put code

if (isset($_GET["phpMap"])){$response = $_GET["phpMap"]; echo $response; }
Sign up to request clarification or add additional context in comments.

Comments

0

If data is sent using POST then you should update your code and change $_GET[] to $_POST[]

2 Comments

oh sorry my bad, ofcorse its GET everywhere
iframe does not inherit the GET values of the parent frame. Try using <iframe src="file.php?phpMap=20"></iframe> instead.
0

You also dont need to declare your variable like that outside of a Class.

$response = $_POST['phpmap']; 

You can also troubleshoot by adding print_r['$_POST'] or print_r['$_GET'] at the top of the script to see what variables if any are coming over. Firebug is also good for capturing POST/GET transmissions and allowing you to see the values being passed back and forth.

Comments

0

You have to change the $_GET into $_POST then it should work with a button click.

If you need to send data from outside of the iframe into the iframe you need to make sure that you write query strings in theurl of the iframe source:

<iframe src="yourfile.php?var=someting"></iframe>

Like that you can recieve the valeue of $var in the script with

<?php $variable = $_GET['var'] ?>

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.