title: Sending sign up data from user to server
body: <p>EDIT:
  I finally figured out where the problem is. I keep getting an IOException on this line
  response = httpClient.execute(httpPost). </p>
  
  <p>However, the normal problems that will cause this error (the ones that I searched online, like the url being wrong and such) are not the problem here. The url is correct. Can anyone help or list all of the possible reasons I would get this error. Thank you.</p>
  
  <hr>
  
  <p>I know this question has been asked several times, and I actually looked at the answers given for those questions in order to originally figure out how to do this but for some reason it's not working and I don't know why.</p>
  
  <p>I have an app that requires a user to sign up. After they sign up I send the information they inputted to the server.</p>
  
  <p>Android code:</p>
  
  <pre><code>//This is the method called when user presses submit button. The variables not declared
  //are global
  public void registerUser(View v){
      context = getApplicationContext();
  
      username = ((EditText) this.findViewById(R.id.username)).getText().toString();
      email = ((EditText) this.findViewById(R.id.email)).getText().toString();
      password=((EditText)this.findViewById(R.id.password)).getText().toString();
  
      String[] params = {username,email,password};
      (new SendRegisterInfo(this.getApplicationContext())).execute(params);
  
      Toast t = Toast.makeText(context, "Thank you for Signing up "+username, Toast.LENGTH_SHORT);
      t.show();
      //Start Main Page Activity. Page they'll see everytime they login
      Intent i = new Intent(this,HomeActivity.class);
      startActivity(i);
  
  }
  
  
  public class SendRegisterInfo extends AsyncTask&lt;String,Void,Void&gt;{
  
  private String tag = "SendRegisterInfo";
  private InputStream is;
  private Context c;
  
  @Override
  protected void onPostExecute(Void result) {
      // TODO Auto-generated method stub
      super.onPostExecute(result);
  }
  
  public SendRegisterInfo(Context c){
      this.c = c;
  }
  
  @Override
  protected Void doInBackground(String... params) {
      String URI="http://www.mysite.com/registerUser.php";
  
      HttpClient httpClient = new DefaultHttpClient();
      HttpPost httpPost = new HttpPost(URI);
      HttpResponse response;
  
      String username,email,password;
      username = params[0];
      email = params[1];
      password = params[2];
  
  
      try {
  
          ArrayList&lt;NameValuePair&gt; submit = new ArrayList&lt;NameValuePair&gt;(2);
          submit.add(new BasicNameValuePair("username",username));
          submit.add(new BasicNameValuePair("email",email));
          submit.add(new BasicNameValuePair("password",password));
          httpPost.setEntity(new UrlEncodedFormEntity(submit));
  
          response = httpClient.execute(httpPost);
          Log.i(tag,response.getStatusLine().toString());
  
      } catch (ClientProtocolException e) {
          Log.e(tag, "Error in http connection "+e.toString());
  
          e.printStackTrace();
      } catch (IOException e) {
          Log.e(tag, "Error in http connection "+e.toString());
  
          e.printStackTrace();
      }catch (Exception e){
          Log.e(tag, "Error in http connection "+e.toString());
  
          e.printStackTrace();
      }
  
      return null;
  }
  
  
  }
  </code></pre>
  
  <p>Manifest File:</p>
  
  <pre><code>&lt;uses-permission android:name="android.permission.ACCESS_WIFI_STATE"/&gt;
  &lt;uses-permission android:name="android.permission.INTERNET"/&gt;
  &lt;uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"/&gt;
  </code></pre>
  
  <p>PHP Code:</p>
  
  <pre><code>&lt;?php
  $username =  $_POST["username"];
  $email =  $_POST["email"];
  $pswrd = $_POST["password"];
  $score = 0;
  
  $user = "root";
  $password="pword";
  $database = "databasename";
  
  mysql_connect(localhost,$user,$password);
  
  mysql_select_db($database) or die("Unable to Select Database");
  
  $query="INSERT INTO Players VALUES ('','$username','$email','$pswrd','','$score')";
  
  mysql_query($query);
  
  mysql_close();
  
  ?&gt;
  </code></pre>