SitePoint Sponsor

User Tag List

Results 1 to 2 of 2
  1. #1
    SitePoint Addict
    Join Date
    Jan 2012
    Posts
    261
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Passing an echo value to another page via JavaScript popup link

    I inherited a script that uses JavaScript to open a popup window (a php file) hosted on another website. At the same time, it's supposed to pass an echo value, but I can't figure out how to echo it.

    For example, let's say you're surfing MySite2/World - where $MySiteID = 'PX' - and you click the following link:

    Code:
    <a href="javascript:;" onClick="MM_openBrWindow('http://www.mysite1.com/Aids/World_Children/Can.php?MySiteID=<?php echo $MySiteID; ?>','IRCAN','scrollbars=yes,resizable=yes,width=175,height=250')">PopUp</a>
    When World_Children/Can.php opens, I want it to inherit the $MySiteID value (PX).

    Or if I visited MySite3/World - $MySiteID = 'Three' - and clicked a similar link, then the same popup (World_Children/Can.php) would open. But this time, it would assume the value $MySiteID = 'Three.'

    So it looks like my JavaScript link is already set up to do just that. I just don't understand what I have to do on the other page (Can.php) to copy and display that value.

    Thanks.

  2. #2
    SitePoint Evangelist
    Join Date
    Oct 2005
    Location
    Michigan, USA
    Posts
    434
    Mentioned
    2 Post(s)
    Tagged
    0 Thread(s)
    It does look like your link is set up to do what you want. In your Can.php file, that value will be accessible using $_GET['MySiteID']

    PHP Code:
    <?php
    echo $_GET['MySiteID'];
    - Robert


Bookmarks

Posting Permissions

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