Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 7 of 7
  1. #1
    New Coder
    Join Date
    May 2008
    Posts
    70
    Thanks
    9
    Thanked 0 Times in 0 Posts

    Using $_GET method in an iframe?

    Hi, i'm pretty new here and not sure if this is the place to post this.
    I'm trying to use the $_GET method in a page which will be inside an iframe. Is there anyway to do so?
    Lets say i have
    www.test.com/user.php?name=pete

    and i have an iframe within the user.php which links to iframe.php, within iframe.php i have the code Welcome <?php echo $_GET["name"]; ?>.

    any help will be appreciated thanks~

  • #2
    God Emperor Fou-Lu's Avatar
    Join Date
    Sep 2002
    Location
    Saskatoon, Saskatchewan
    Posts
    16,994
    Thanks
    4
    Thanked 2,662 Times in 2,631 Posts
    Think of an iframe as a window to another webpage. The only way to display that would be to use the _GET/_POST/__COOKIE to pass it to the new page.
    The better solution would be to run through sessions instead, this way if each of the pages are located on your server the sessions will all access the same value, allowing data sharing between the different webpages.

    Does that make sense?
    PHP Code:
    header('HTTP/1.1 420 Enhance Your Calm'); 
    Been gone for a few months, and haven't programmed in that long of a time. Meh, I'll wing it ;)

  • #3
    New Coder
    Join Date
    May 2008
    Posts
    70
    Thanks
    9
    Thanked 0 Times in 0 Posts
    Yeah, i wanted to use session. But then the problem is, i wanted to show this page with info if someone go to this user's page.

  • #4
    God Emperor Fou-Lu's Avatar
    Join Date
    Sep 2002
    Location
    Saskatoon, Saskatchewan
    Posts
    16,994
    Thanks
    4
    Thanked 2,662 Times in 2,631 Posts
    Yep, ok then just pass it along to the included iframe url. Thats something that you will need with your targeting and just append the get parameter (or post) to the page to send it to.

    Does that help to clear it up?
    PHP Code:
    header('HTTP/1.1 420 Enhance Your Calm'); 
    Been gone for a few months, and haven't programmed in that long of a time. Meh, I'll wing it ;)

  • Users who have thanked Fou-Lu for this post:

    crays (05-15-2008)

  • #5
    Regular Coder Stooshie's Avatar
    Join Date
    Mar 2008
    Location
    Dundee, Scotland
    Posts
    378
    Thanks
    9
    Thanked 39 Times in 39 Posts
    When you call the frame you need to call it with the name parameter set from the main page. eg
    Code:
    <iframe src="framepage.php?name=<?php echo($_GET["name"]); ?>"></iframe>
    --- EDIT ---
    Ooops! I had started this in quick reply then got interupted. didn't realise everyone else had answered.
    Regards, Stooshie
    O

  • Users who have thanked Stooshie for this post:

    crays (05-15-2008)

  • #6
    New Coder
    Join Date
    May 2008
    Posts
    70
    Thanks
    9
    Thanked 0 Times in 0 Posts
    Thanks guys, useful info. Thanks alot !

  • #7
    New to the CF scene
    Join Date
    Mar 2009
    Posts
    1
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Quote Originally Posted by Stooshie View Post
    When you call the frame you need to call it with the name parameter set from the main page. eg
    Code:
    <iframe src="framepage.php?name=<?php echo($_GET["name"]); ?>"></iframe>
    --- EDIT ---
    Ooops! I had started this in quick reply then got interupted. didn't realise everyone else had answered.
    I registered to this forum just to thank you. you solved my all problems
    greets from Turkey


  •  

    LinkBacks (?)


    Posting Permissions

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