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

Get help using Construct 2

Post » Sun Jul 13, 2014 2:13 pm

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

Code: Select all
<?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>


to

Code: Select all
<?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>


And in the game, I tried to pass 2 variables like this
Code: Select all
"https://www.facebook.com/sharer/sharer.php?u=http://www.yourweb.com/share.php?level="&currlev&":"&random(1,10)&"&"&"score="&highscore&":"&random(1,10)



Strangely it only reads the first variable passed which is currentlevel and skip the highscore variable

Any helps?


Nvm, I tweaked it and fixed it :D
Last edited by ijoin on Sun Jul 13, 2014 2:29 pm, edited 1 time in total.
B
8
S
2
Posts: 203
Reputation: 1,169

Post » Sun Jul 13, 2014 2:25 pm

Fixed, just a little php problem :D
B
8
S
2
Posts: 203
Reputation: 1,169


Return to How do I....?

Who is online

Users browsing this forum: No registered users and 7 guests