ganjan
ganjan

Reputation: 7576

$_GET shows up blank when called from a php file within iframe

I have a a login in script that is a little to complicated for my own good. I have a php file that calls a javascript based on the $_GET variable. The javascript/jquery makes html that uses iframe to call another php file, but I need the $_GET variable in that php code or I need to pass the $_GET variables to the other php file within Iframe in another way. I could to this with a cookie, but was hoping there was a better way of doing it. Getting the $_GET variables from the url would be the best way I think.

To sum up. I have a php file that is called like this <iframe src ="site.php" in site.php I need the $_GET variables from the URI, but that shows up blank..

I also tries this '<iframe src ="site.php?'.http_build_query($_GET).'" with no luck

Here is a more detailed version of the structure:

Upvotes: 0

Views: 271

Answers (1)

Pekka
Pekka

Reputation: 449525

http_build_query() is exactly the right way to go about this. If you are doing this in the page that gets the GET parameters, the code you show should be working.

Upvotes: 2

Related Questions