Jump to content

$_GET from iframe Child


ebolt007

Recommended Posts

I'll try to explain the best I can, everything online $_GET's information from the parent to the child, which I can do, I just can't go in reverse. So I have a site, with a calendar and buttons. When a date is clicked on it modifies the iframe with that date's month and day in the iframe url. ie: http://www.url.com/page.php?mon=201110&day=7  I need to get the mon and day from the child iframe URL so I can put this on other buttons on the parent url. I can't figure out how to get these and turn them into a variable tho. Basically as simple as...

$cur_mon = $_GET['mon'];
$cur_day = $_GET['day'];
        //link to open iframe with correct mon and day generated
echo "<a href=\"iframe.php?mon=$cur_mon&day=$cur_day\"  target=\"iframe\">Event for $cur_mon</a>\n";

 

I just can't figure out what to ad to the $_GET, or from what I've been reading, how to integrate the javascript to pull the mon and day from the iframe url.

 

Thanks

Link to comment
https://forums.phpfreaks.com/topic/248590-_get-from-iframe-child/
Share on other sites

PHP can't do anything with frames so you're left with using JavaScript.

 

Create a function on the parent page that takes the month and day and does whatever you want it to do.

Inside the iframe.php you can call that function:

parent.whatever_function_you_made($cur_mon, $cur_day);

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.