0

I have a registration form where user can fill their information then I want to store these values onto my PHP server. This is where I am storing data from user input... I have to send this data to my PHP server. Please suggest any method by which I can it to php Server either by using JSON or Http

"HttpClient", "HttpPost", "HttpResponse", "HttpEntity", "EntityUtils", "NameValuePair", "BasicNameValuePair" are Deprecated. Please suggest another solution.

public void signUp(View view) 
{
    EditText nameedit = (EditText) findViewById(R.id.name);
    EditText emailedit = (EditText) findViewById(R.id.emailid);
    EditText contactedit = (EditText) findViewById(R.id.contact);
    EditText collegeedit = (EditText) findViewById(R.id.college);
    CheckBox accommodationcheck = (CheckBox) findViewById(R.id.accommodation);
    CheckBox raftingcheck = (CheckBox) findViewById(R.id.rafting);
    Spinner spinner= (Spinner) findViewById(R.id.spinner);
    String acc = String.valueOf(accommodationcheck.isChecked());
    String raf = String.valueOf(raftingcheck.isChecked());
    String name = nameedit.getText().toString();
    String email = emailedit.getText().toString();
    String contact = contactedit.getText().toString();
    String college = collegeedit.getText().toString();
    String gender=spinner.getSelectedItem().toString();
    SharedPreferences sharedPreferences = getSharedPreferences("SIGNUP", Context.MODE_PRIVATE);
    SharedPreferences.Editor editor = sharedPreferences.edit();
    if (name.isEmpty() || email.isEmpty() || contact.isEmpty() || college.isEmpty()) 
    {
        Toast.makeText(this, "Please fill all the required field", Toast.LENGTH_LONG).show();

    } 
    else
    {

        editor.putString("accomodation", acc);
        editor.putString("rafting", raf);
        editor.putString("name", name);
        editor.putString("email", email);
        editor.putString("contact", contact);
        editor.putString("college", college);
        editor.putString("gender", gender);
        editor.apply();
    }
}
rozer
  • 131
  • 15
  • 1
    Check out [this](http://stackoverflow.com/questions/2938502/sending-post-data-in-android). I hope it will help you :) – Alvin Dec 24 '15 at 15:32
  • "HttpClient", "HttpPost", "HttpResponse", "HttpEntity", "EntityUtils", "NameValuePair", "BasicNameValuePair" are Deprecated. Please suggest another solution. – rozer Dec 26 '15 at 05:04

0 Answers0