[Solved] How do I Pass 2 variable to php?

0 favourites
  • 2 posts
From the Asset Store
Easily store, modify, read and manipulate colors with Color Variables!
  • So, in my search for a tutorial about posting score to Facebook, I found https://www.scirra.com/TutorialViewFresh.aspx?ID=908

    The code works perfectly, but it only shows highscore, now I want to add another variable called current level, so I changed the codes from

    <?php
    $score = $_GET["score"];
    $scorex = explode(":", $score);
    $highscore = $scorex[0];
    ?>
    <html>
    <head>
    <title>Game HighScore</title>
    <meta property="og:title" content="Highscore is<?echo $highscore;?>!"/>
    <meta property="og:image" content="http://weebe.nl/jellojumper/jello.png"/>
    <meta property="og:site_name" content="Game"/>
    <meta property="og:description" content="<?echo $highscore;?> Nice!?"/>	
    </head>
    <body>
    <meta http-equiv="refresh" content="0;URL=http://www.yourweb.com" />
    
    </body>
    </html>[/code:2k2f8oeg]
    
    to
    
    [code:2k2f8oeg]<?php
    $score = $_GET["score"];
    $scorex = explode(":", $score);
    $highscore = $scorex[0];
    
    $level= $_GET["level"];
    $levelx= explode(":", $level);
    $currlevel= $levelx[0];
    ?>
    <html>
    <head>
    <title>HighScore</title>
    <meta property="og:title" content="Highscore Level <?echo $currlevel;?> is <?echo $highscore;?>!"/>
    <meta property="og:image" content="http://weebe.nl/jellojumper/jello.png"/>
    <meta property="og:site_name" content="Game"/>
    <meta property="og:description" content="<?echo $highscore;?> Nice?"/>	
    </head>
    <body>
    <meta http-equiv="refresh" content="0;URL=http://www.yourweb.com" />
    
    </body>
    </html>[/code:2k2f8oeg]
    
    And in the game, I tried to pass 2 variables like this
    [code:2k2f8oeg]
    "https://www.facebook.com/sharer/sharer.php?u=http://www.yourweb.com/share.php?level="&currlev&":"&random(1,10)&"&"&"score="&highscore&":"&random(1,10)[/code:2k2f8oeg]
    
    Strangely it only reads the first variable passed which is currentlevel and skip the highscore variable
    
    Any helps?
    
    [b]Nvm, I tweaked it and fixed it [/b]
  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • Fixed, just a little php problem

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)