[SOLVED] A little help with php post with wwwform please? It should be simple

Hi there.

I’m not familiar with php, I am with Objective C and C# but not with PHP, so a friend gave me this as the method I have to use with WWWForm, it just sends the level number so the php can update the number of times that level has been visited, something simple and general.

I’m a bit lost with WWWForm and how to use this, I could use a little (or a big) help :slight_smile:

<form action="actualizar.php" method="post">


Nivel:

 <input type="text" name="nivel"/>


<input type="submit" value="incrementar" />


</form>

Thanks in advance guys!

Cheers.

No idea from anyone?

It should be easy, but I’m not familiar with PHP, please help me here :stuck_out_tongue:

Cheers and thanks!

Ok, I solved this, it was very easy in fact, but I was a bit confused on how does it works, I’ll post my code here for other people with the same doubt.

I used an IEnumerator function with the level string as parameter, this will be the level number that the php is asking for, I add the “nivel” field with the level value to the form, after that I just load the php page with the form included.

IEnumerator level_stats(string level)
{
    WWWFormstats = newWWWForm();

    stats.AddField("nivel",level);

    WWW publish_stats = newWWW("http://mysite.com/actualizar.php", stats);

    yield return publish_stats;

    if(publish_stats.error == null)
    {
        Debug.Log(publish_stats.text);
     }
    else
    {
        Debug.Log(publish_stats.error);
    }

}

To launch this function I start a coroutine with the correspondin level string.

StartCoroutine(level_stats("4"));

Pretty easy indeed, but I was a bit confused :slight_smile:

Cheers!