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

    Join Date
    Jun 2001
    Posts
    3
    Rep Power
    0

    Javascript to PHP ?


    Is there a way to convert a variable in java to PHP?
  2. #2
  3. Contributing User
    Devshed Novice (500 - 999 posts)

    Join Date
    Feb 2000
    Location
    Perth West Australia
    Posts
    757
    Rep Power
    15
    Yes but not withut a page refresh, you can set a cookie in javascript that PHP can then access, or you can include a javascript variable in a link or form input, ie

    <script>
    function go(){
    var thisvar="wombat";
    location.href='next.php?var='+thisvar;
    }
    </script>

    when called this would redirect to next.php where you can call the variable $var
    resistance is no longer futile :: 423
  4. #3
  5. No Profile Picture
    Junior Member
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jun 2001
    Posts
    3
    Rep Power
    0
    I would prefer not to refresh the page.

    Would it be possible to do this by including the script code from another file?

    Code:
    <script LANGUAGE="javascript" src="http://URL_TO_CODE.php?var=+top.location"></script>
    This doesn't work. But is it possible to do it in a similair way and include the variable there. E.g. if you could do:

    <script>

    include the file

    </script>

    somehow?
  6. #4
  7. No Profile Picture
    Gödelian monster
    Devshed Regular (2000 - 2499 posts)

    Join Date
    Jul 1999
    Location
    Central Florida, USA
    Posts
    2,307
    Rep Power
    61
    This question was asked just a couple of days ago. See my responses in this thread.
    The real n-tier system:

    FreeBSD -> PostgreSQL -> [any_language] -> Apache -> Mozilla/XUL

    Amazon wishlist -- rycamor (at) gmail.com
  8. #5
  9. No Profile Picture
    Member
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jun 2001
    Posts
    11
    Rep Power
    0

    thats cool


    So in ensence... Your writing the javascript on the fly to the browser while the php parser is still running on the server dishing out more javascript...

    Still trying to get a grasp on all this stuff.....


    TimeImp
  10. #6
  11. No Profile Picture
    Junior Member
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jun 2001
    Posts
    3
    Rep Power
    0
    This question was asked just a couple of days ago. See my responses in this thread.
    Thanks! Your solution worked.


    So in ensence... Your writing the javascript on the fly to the browser while the php parser is still running on the server dishing out more javascript...
    That's correct. I want my customers to add a certain javascript that will load some stuff from my server, but I need to know on what site they added the javascript.

IMN logo majestic logo threadwatch logo seochat tools logo