www.webdeveloper.com
Results 1 to 5 of 5

Thread: Passing variables from PHP page 1 to an iframe residing in PHP page2

Hybrid View

  1. #1
    Join Date
    Sep 2013
    Posts
    3

    Passing variables from PHP page 1 to an iframe residing in PHP page2

    Can't solve this problem. If the iframe resides in page 1 everything is working fine, but not when the iframe is in page 2.

    How to solve this?

    // Gide

  2. #2
    Join Date
    Mar 2011
    Posts
    1,137
    The only way to do what you want is to pass the data with a cookie or in $_SESSION variables. You can't directly pass data to a document that resides in an <iframe> in a second document with HTML alone.
    Rick Trethewey
    Rainbo Design

  3. #3
    Join Date
    Sep 2013
    Posts
    3
    Thanks for the answer!

    How do I do this in practise? I have never worked with cookies and/or cookies.
    Please help!

  4. #4
    Join Date
    Apr 2012
    Posts
    38
    You need to include the following code on each page you want to use the session information:

    Code:
    <?php
    session_start();
    ?>
    You can set variables on a usual way in the session variable and asking it back as well:

    Code:
    $_SESSION['name-for-your-variable'] = 'here your data';
    echo $_SESSION['name-for-your-variable'];
    If you need the data to be available even after the visitor has closed his/her browser and then comes back to your webpage you should consider using cookies.
    http://www.w3schools.com/php/php_cookies.asp

  5. #5
    Join Date
    Sep 2013
    Posts
    3
    Thanks a lot for help!

    Just working fine now!

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center



Recent Articles