title: insert information to external DB in android studio
body: <p>I'm using android studio to get information from user and insert it into external DB, and i saw a lot of videos in youtube but still there is a problem when run it says: "registration success" but doesn't insert into DB</p>
  
  <p>This is my code in android studio </p>
  
  <p>public class signup extends AppCompatActivity {</p>
  
  <pre><code>EditText email,password,name;
  Switch visually_impaired;
  String Email,Password,Name,Visually_impaired,Beacon_alert,Buildings_alert;;
  Context ctx = this;
  
  @Override
  protected void onCreate(Bundle savedInstanceState) {
      super.onCreate(savedInstanceState);
      setContentView(R.layout.activity_signup);
      name = (EditText) findViewById(R.id.name_editText);
      password = (EditText) findViewById(R.id.password_editText);
      email = (EditText) findViewById(R.id.email_editText);
      visually_impaired = (Switch) findViewById(R.id.blindOpt);
  
  }
  
  public void register(View v){
      Email = email.getText().toString();
      Name = name.getText().toString();
      Password = password.getText().toString();
      Visually_impaired = visually_impaired.getText().toString();
      BackGround b = new BackGround(this);
      b.execute(Email,Password,Name,Visually_impaired);
  }
  
  class BackGround extends AsyncTask&lt;String,String,String&gt; {
  
      Context ctx;
      public BackGround(Context ctx){
          this.ctx = ctx;
      }
  
      @Override
      protected String doInBackground(String... strings) {
          String email = strings[0];
          String password = strings[1];
          String name = strings[2];
          String visually_impaired = strings[3];
  
          try {
              URL url = new URL("http://ksuexpress.com/register.php");
              HttpURLConnection httpURLConnection = (HttpURLConnection) url.openConnection();
              httpURLConnection.setRequestMethod("POST");
              httpURLConnection.setDoOutput(true);
              OutputStream os = httpURLConnection.getOutputStream();
              BufferedWriter bufferWriter = new BufferedWriter(new OutputStreamWriter(os,"UTF-8"));
              String data = URLEncoder.encode("email","UTF-8")+ " = "+URLEncoder.encode(email,"UTF-8") +"&amp;"+
                      URLEncoder.encode("password","UTF-8")+ " = "+URLEncoder.encode(password,"UTF-8") +"&amp;"+
                      URLEncoder.encode("name","UTF-8")+ " = "+URLEncoder.encode(name,"UTF-8") +"&amp;"+
                      URLEncoder.encode("visually_impaired","UTF-8")+ " = "+URLEncoder.encode(visually_impaired,"UTF-8");
              bufferWriter.write(data);
              bufferWriter.flush();
              bufferWriter.close();
              os.close();
              InputStream is = httpURLConnection.getInputStream();
              is.close();
              return "Registration success....";
  
          } catch (MalformedURLException e) {
              e.printStackTrace();
          } catch (IOException e) {
              e.printStackTrace();
          }
  
          return null;
      }
  
      @Override
      protected void onPostExecute(String result){
          Toast.makeText(ctx,result,Toast.LENGTH_LONG).show();
  
      }
  }
  </code></pre>
  
  <p>}</p>
  
  <p>and also i have a php code in server that uses POST and insert it to the DB</p>
  
  <p>can anyone help me please ...</p>