I want to insert data from my Form to my server using HTTP Web POST. I have my code below I am unable to get the value of JObject json and send it into my php code.
var caf = entCafNo.Text;
string url = "http://192.168.120.9:7777/TBS/mobile-request.php?Host=" + Constants.hostname + "&Database=" + Constants.database + "&Request=SendCaf";
string contentType = "application/json";
JObject json = new JObject
{
{ "CAF", caf }
};
HttpClient client = new HttpClient();
var response = await client.PostAsync(url, new StringContent(json.ToString(), Encoding.UTF8, contentType));
PHP Code:
$request = $_GET["Request"];
if($request == "SendCaf"){
$caf = $_POST["CAF"];
$sql = "INSERT INTO tblCaf(CAFNo)
VALUES('$caf)";
mysqli_query ($conn, $sql);
}