How to send php get parameters to an iframe?

by dalton_moen , in category: HTML & CSS , 8 months ago

How to send php get parameters to an iframe?

Facebook Twitter LinkedIn Telegram Whatsapp

1 answer

Member

by domenico , 8 months 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.

Related Threads:

How to get url parameters or send 'get' request to graphql?
How to get url parameters and use in iframe?
How to get url parameters using shopify liquid?
How to send parameters using guzzle client in symfony?
How to get an array from get url parameters in laravel?
How to pass utm parameters to an iframe?