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 3 of 3
  1. #1
    New Coder
    Join Date
    Apr 2011
    Posts
    92
    Thanks
    26
    Thanked 0 Times in 0 Posts

    passing a php variable to a javascript modal popout window

    On my main page, I have a list of item ID's which are assigned variables, the list is concatenated and so the variables are always different.

    So another thing that gets concatenated is a link, which uses javascript/jquery to open a popout modal window which is another php file called sharepost.php. I want to be able to transfer the php variables from the main page to append them on the end of the sharepost.php URL so I can use $_GET to grab them for use.

    Here's what I have... not working, but I figured I'd give it a try.

    Code:
    <?php
    
    //use mysql to loop through some variables
    $post_id = $setvalue;
    $member_id = $anothersetvalue;
    
    
    $list .= '
    
    <div> ' . $post_id . ' </div> <div> ' . $member_id . ' </div> <div> <a href="#" class="button" onClick="openup(); return false">Share This Post</a> </div> $the_link = " http://sharepost.php?post_id=' . $post_id . '&member_id=' . $member_id . ' ";
    '; ?> <HTML> <head> <script> // Displays an external page using an iframe function openup(){ var src = "<?php echo $the_link;?>"; $.modal('<iframe src="' + src + '" height="450" width="830" style="border:0">', { closeHTML:"", containerCss:{ height:150, padding:0, width:350 }, overlayClose:true, }); } </script> </head> <body>
    <?php echo $list;?>
    </body> </HTML>

  • #2
    New Coder
    Join Date
    Apr 2011
    Posts
    92
    Thanks
    26
    Thanked 0 Times in 0 Posts
    Everything is working fine EXCEPT- the variables ($post_id and $member_id) in the generated URL, are only getting the LAST value of the mysql query....

    Even though the echoed variables in the $list, are getting the correct concatenated values.

  • #3
    Senior Coder
    Join Date
    Dec 2010
    Posts
    2,391
    Thanks
    11
    Thanked 568 Times in 561 Posts
    MySQL query? There is no such query. Loop? There is no loop ... please post the full/relevant code


  •  

    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
    •