#1
  1. No Profile Picture
    Junior Member
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jun 2001
    Posts
    4
    Rep Power
    0

    passing values to javascript functions


    How can I pass a value from a php page to a javascript function that calls a pop up window of another php page? Please keep reply in child like terms, thanks.
  2. #2
  3. No Profile Picture
    Embittered Cynic
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jul 2001
    Location
    38.97 N, 94.67 W
    Posts
    11
    Rep Power
    0

    Re: passing values to javascript functions


    Originally posted by smedcalf
    How can I pass a value from a php page to a javascript function that calls a pop up window of another php page? Please keep reply in child like terms, thanks.
    Here's an example:

    <SCRIPT type="text/javascript">
    function rand() {
    // shows a random image (randomized at the server)
    document.location = "<?php echo "$PHP_SELF?i=$rand" ?>"
    }
    </SCRIPT>

    The document containing this is a .php file, if that's not obvious. This way, you can assign variables, or generate function calls or whatever using variables accessible to your PHP script. Just echo the PHP variables where you want them in your Javascript.
    +++linear+++
    PHP Security Questions? start here
  4. #3
  5. No Profile Picture
    Divine Wind
    Devshed Newbie (0 - 499 posts)

    Join Date
    May 2001
    Location
    Mongo
    Posts
    24
    Rep Power
    0

    Re: passing values to javascript functions


    Originally posted by smedcalf
    How can I pass a value from a php page to a javascript function that calls a pop up window of another php page? Please keep reply in child like terms, thanks.
    You might want to give us a bit more information if you want a specific answer - is it to the same page or different pages, etc.? It can be done but there are many different combinations and permutations (e.g. I've got some script which sends a value to a search page located in a frame in the pop-up window - the value coming from a drop down menu).

    Emps

IMN logo majestic logo threadwatch logo seochat tools logo