How to send php get parameters to an iframe?

by dalton_moen , in category: HTML & CSS , 5 days ago

How to send php get parameters to an iframe?

Facebook Twitter LinkedIn Telegram Whatsapp

1 answer

Member

by domenico , 4 days ago

@dalton_moen 

To send PHP GET parameters to an iframe, you can include the parameters in the URL of the iframe source. Here is an example:

1
<iframe src="iframe.php?param1=value1&param2=value2"></iframe>


In the iframe.php file, you can retrieve the GET parameters using the $_GET superglobal array:

1
2
3
4
5
$param1 = $_GET['param1'];
$param2 = $_GET['param2'];

echo "Param 1: $param1 <br>";
echo "Param 2: $param2 <br>";


This will load the iframe with the specified parameters in the URL, and the iframe.php file will be able to access and use those parameters.