mardi 22 décembre 2015

Sending script to php file with URLLoader returns 0 when I try to GET it

I have a game, I want to write score in my database when the game is over. This is the urlloader function:

public function gameFinished(){
    var urlLoader:URLLoader = new URLLoader();
        var req:URLRequest = new URLRequest("/../../sendScoreUnit4.php");
       var requestVars:URLVariables = new URLVariables();
       requestVars.score = total_score_hard; = requestVars.score;
       req.method = URLRequestMethod.POST;

My sendScoreUnit4.php file tries to get the score like so :

$score = (int)$_GET['score'];

but when I echo it I get 0 every time. Any help would be appreciated.

Aucun commentaire:

Enregistrer un commentaire