How to target iframe using PHP

Discussion in 'PHP' started by sajeeshmathew, Jan 7, 2009.

  1. #1
    hai, i am new to php. i have some problem with iframe.please help me

    How to pass a message from a parent php page to an iframe in it.I need the data to be processed in frame and got back to parent page to display.

    in detail. I have an address lists and and i need to edit it. when i click edit,it has to go to iframe and.After edit in iframe the result to be displayed in parent page.

    thanks in advance
     
    sajeeshmathew, Jan 7, 2009 IP
  2. sandstorm140

    sandstorm140 Peon

    Messages:
    80
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #2
    Rather than using iframes, i'd suggest using the php include/require function.
    Here's how:

    <?php include('filename.php'); ?>
    or
    <?php require('filename.php'); ?>

    more information about this function available here:
    http://www.php.net/manual/en/function.include.php
     
    sandstorm140, Jan 8, 2009 IP
  3. absurdtrivia

    absurdtrivia Peon

    Messages:
    29
    Likes Received:
    2
    Best Answers:
    0
    Trophy Points:
    0
    #3
    If you must use an iframe, the only way to update the parent page is with javascript.

    When the php page in the iframe is finished loading, you have it call a piece of javascript like parent.getElementById['id'].innerHTML = 'Done processing';

    Both the iframe and parent page must be on the exact same domain.
     
    absurdtrivia, Jan 8, 2009 IP