Forum Xamarin.Android
We are excited to announce that the Xamarin Forums are moving to the new Microsoft Q&A experience. Q&A is the home for technical questions and answers at across all products at Microsoft now including Xamarin!

We encourage you to head over to Microsoft Q&A for .NET for posting new questions and get involved today.

how to display echo statment from php file in xamarin.android? Ask Question

phani155phani155 INMember ✭✭
edited October 2017 in Xamarin.Android

i want to display echo statement which i entered in my php file.can any one send me the code. below is my .cs code

HttpClient http = new HttpClient();
string link = "https://profitless-sevens.000webhostapp.com/add_employee.php";
var sending_data = new FormUrlEncodedContent(new[]
{
new KeyValuePair<string,string>("emp_id", emp_id.Text),
new KeyValuePair<string,string>("emp_name", emp_name.Text),
});
Toast.MakeText(this, " Employee Added Successfully.... ", ToastLength.Short).Show();
HttpResponseMessage response = await http.PostAsync(link, sending_data);
var responsedone = await response.Content.ReadAsStringAsync();

this is my php code

<?php $conn = mysqli_connect("localhost", "id1825094", "12345", "storagevalues"); $emp_id = $_POST["emp_id"]; $emp_name = $_POST["emp_name"]; $query = "INSERT into Employee_registration values('$emp_id','$emp_name')"; if (mysqli_query($conn, $query)) { echo "inserted"; } else { echo "error"; } ?>
Sign In or Register to comment.