How to use post method in construct 2

0 favourites
  • 9 posts
From the Asset Store
Casino? money? who knows? but the target is the same!
  • Hi,

    I m new to novice to construct 2, I'm using constuct r178 release.

    I have created one capx file for the example .

    basically file is used to send textbox value to the php page via POST method and that data is stored into the database.

    By doing so I am facing some error because of that I'm not able to retrieve the data in the php file.Please suggest me the solution

    Here is the php code for the reference

    <?php

    /*db connection menthod*/

    header("Access-Control-Allow-Origin: *");

    $query = mysql_query("insert into score (`score`)values('".$_POST['score']."')");

    if($query)

    echo "done";

    else

    echo "notdone";

    ?>

    /*getting error of */

    Notice: Undefined index: score in

    Please suggest your opinion.

  • You need to send

    "score=" & val[/code:296t237o] as the data instead of just val.
  • Thanks a lot buddy,

    is there any way by which we can send multiple data via post method.

    also tell me how can I encrypt the data before sending via post method.

    and decrypt in php.

    Thanks.

  • Hi neocreed,

    I use a simple method to encrypt my values. Do some math on the value like ln, log10, etc. plus some multiplication, division. Do that twice using a different approach for the second one, then send both values to the php file, reverse the math and compare the two values, they should be the same.

    This is quiet difficult to hack, since you would have to find both math methods and any simple try to fake the values will result in inequality of the two values, so you know they are invalid.

    Regards

    Frank

  • Sending multiple values:

    "score=" & score & "&level=" & level & "&time=" & time[/code:x9bpao2k]
  • Thanks buddy,

    can you also tell me with example.

    I'm sending some data from php file like

    <?php

    echo $data=10;

    ?>

    how can I read the echoed data in construct 2

    in the end I wants to read data of php into the construct 2

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Make your AJAX call, then in the completed event read the data.

  • Sending multiple values:

    "score=" & score & "&level=" & level & "&time=" & time[/code:30pl057g]
    

    It's not working this way,

    Can you please send me with example.

    Thanks

  • [attachment=0:2mticego][/attachment:2mticego]

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