#1
  1. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jun 2002
    Posts
    8
    Rep Power
    0

    Javascript To Php


    I have some games on my site that users play. How can I get php to echo the score?
    Thanks In Advance
  2. #2
  3. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jul 2000
    Location
    CA US
    Posts
    62
    Rep Power
    15
    Not sure of the exact application, but you could force a url change in the JavaScript and push the score to the page and display in php.
    Example:
    window.location.href="http://www.mydomain.com/showscore.php?score=" + this_score;

    or you could possibly update the score field on the screen.
    ex:
    document.....ThisScoreField.value=this_score;

    I hope this helps and good luck,

    Scott
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    Scott B. Pier
    ScottBP@amalla.com
    http://www.amalla.com
  4. #3
  5. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Mar 2001
    Location
    Burlington, VT
    Posts
    344
    Rep Power
    14
    Hello,

    The thing you need to remember here is that PHP is server side & JavaScript is client-side. If you are trying to display the score in the manner which you are suggesting it is going to require some sort of screen reload (or frames or pop-up windows)... If you have some free time on your hands there are several ways to be sneaky about this. You may even want to consider using a Flash scoreboard, which would require that reload.

    Anyway, I hope this helps,
    -jbuckle24
    ------------------------------------------------------------
  6. #4
  7. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jun 2002
    Posts
    8
    Rep Power
    0
    but if I did:

    showscore.php?score=100

    they could change it!

IMN logo majestic logo threadwatch logo seochat tools logo