Sending variables to HTML

I’ve been trying to work out the details of sending a simple int variable to display on a website I manage. I can’t tell if I’m bypassing something essential in this process (like setting up a more complicated server), but I’ve been trying to get WWWForms to work and can’t get it to display the variable online correctly.

using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.Networking;

public class WWW_output : MonoBehaviour {

	void Start () {
		int num;
		num = 12;

		string url = "http://myurl/test.php";

		WWWForm form = new WWWForm ();
		form.AddField("var_1", num.ToString());
		WWW www = new WWW (url, form);

		StartCoroutine (Upload (www));
	}

	IEnumerator Upload(WWW www){
		yield return www;

		if (www.error == null){
			Debug.Log (www.text);
		}
		else{
			Debug.Log ("unable to update data:" + www.error);
		}
        }
}

However, when I run the game the information parses correctly and I can see the www.text to display correctly in Unity’s console. I’d really like to make sure that I can also just simply display the num.ToString in the browser as well. So I just tried running a simple php template:

<!DOCTYPE HTML>
<HTML>
    <BODY>
		<?php echo $_POST["var_1"] ?>
    </BODY>
</HTML>

But no avail… Any thoughts?

Please do try this first

Instead of doing this form.AddField("var_1", num.ToString()); all of a sudden just simple do it like this first form.AddField("var_1", var1); then after that on you php call it like this

PHP

$var1= $_POST["var_1"];
<?php echo (var);  ?>

Then if that works your num.ToString(); is wrong??