How to get a variable from a PHP-file in a simple way (Q)

Welcome to our brand new Clickteam Community Hub! We hope you will enjoy using the new features, which we will be further expanding in the coming months.

A few features including Passport are unavailable initially whilst we monitor stability of the new platform, we hope to bring these online very soon. Small issues will crop up following the import from our old system, including some message formatting, translation accuracy and other things.

Thank you for your patience whilst we've worked on this and we look forward to more exciting community developments soon!

Clickteam.
  • Hi!
    I know this should be simple, but I need help to get explained in a simple way.
    The tutorials that is (Online Registration and Login & Online Scores using PHP / mySQL) is to complex right now.
    And all other information and threads I find is containing to much of... what I don't understand.

    So, I need it explained very simple way and in right order 1.2.3.4... :)

    1). I know how to setup variables in PHP already.
    2). How to get the variable to MMF2 (I suppose "Get Object" will work fine).
    (I don't get it if I should get the URL using an edit box or not).
    3). How to put the variable to a string.

    Best Regards // Daniel P

  • I don't know any PHP, but since you seem know the PHP part, maybe I can help you out anyway.
    When your app calls the server using the GET object, the server needs to put the requested variable on the webpage. That's it, really. The GET object will return whatever is on the webpage after the servercode is executed. So the rest of the page must be completely blank, only the part that should be sent back to your app should be on the page.

    If your webpage is Please login to see this link., then request this url using the GET object. You don't need to use an edit box for this. The GET object will return whatever testpage.php contains.

    In the On Get Complete event, set the string to Received$( "Get object" )

  • Aahh! OMG, to easy. It worked like a charm.

    Ok, can you help me with next step to?

    What if there is 2 or more variables on the page and other code?
    How can I get just the values from those variables in to strings in MMF2? :)

    Best Regards // Daniel P

  • On the server you can output the variables like this: Var1:Var2:Var3
    Then you use the String Parser object or String Tokenizer object in MMF2 to split the string, using ":" as the delimeter.
    If you use String Parser, then Add ":" as the delimiter, then set the whole string as the source. Now you can retrieve element 1, 2 and 3, which would be Var1, Var2 and Var3.

    What do you mean by other code? If you want your app to decide what code on the server to be executed, you can add parameters to the url, like this: testpage.php?q=getscores&playerid=123
    Then you need to check on the server paramter "q" is, and execute the corresponding code.

Participate now!

Don’t have an account yet? Register yourself now and be a part of our community!