title: Android HTTPPost List<NameValuePair> post to php?
body: <p>I have been searching for hours and I am still unclear on <code>HTTPPost</code> method. I have code like this...</p>
  
  <pre><code>httpclient = new DefaultHttpClient();
  httppost = new HttpPost(url);
  // Add your data
  Log.i("ACTIVITY","PostInfo");
  List&lt;NameValuePair&gt; pairs = new ArrayList&lt;NameValuePair&gt;();
  pairs.add(new BasicNameValuePair("email", stringeditemail));
  httppost.setEntity(new UrlEncodedFormEntity(pairs));
  </code></pre>
  
  <p>Is this supposed to post the information to the given php from the designated site?
  If so, What am I doing wrong that it is not posting?</p>
  
  <p>This is my PHP</p>
  
  <pre><code>&lt;?php
  
  
  require('include/config.php');
   require('include/function.php');
  require('classes/captcha.class.php');
  require('language/' .$_SESSION['language']. '/signup.lang.php');
  
  if ( $config['user_registrations'] == 0 ) {
  $msg = $lang['signup.registration_disabled'];
  session_write_close();
  header('Location: index.php?msg=' .$msg);
  die();
  }
  
  $email      = NULL;
  if ( isset($_REQUEST['action_signup']) &amp;&amp; $_REQUEST['action_signup'] != '' ) 
  {
  $email      = $filterObj-&gt;process(trim($_POST['email']));
  
  if( $email == '' )
      $err = $lang['signup.email_empty'];
  elseif ( !check_email($email) )
      $err = $lang['signup.email_invalid'];
  elseif ( check_field_exists($email, 'email', 'signup') == 1 )
      $err = $lang['signup.email_exists'];
  
  $_REQUEST['pack_id'] == '' )
      $err = $lang['signup.select_package'];
  
      if ( $err == '' ) {
      $email      = mysql_real_escape_string($email);
  
      $sql        = "insert into signup set email='" .$email. "';
      $conn-&gt;execute($sql);
  
  
      if( $config['enable_package'] == 'yes' ) {
          $pack_id = mysql_real_escape_string($_REQUEST['pack_id']);
          $sql = "select * from package where pack_id='" .$pack_id. "'";
          $rs  = $conn-&gt;execute($sql);
  
          } else {
              $sql = "update signup set acount_status='Inactive' where        UID='" .$userid. "' limit 1";
              $conn-&gt;execute($sql);
              session_write_close();
              header("Location: pack_ops.php?pack=$_REQUEST[pack_id]&amp;uid=".base64_encode($userid));
              die();
          }
      }
  
      $sql = "INSERT INTO users_online (UID, online) VALUES (" .$userid. ", " .time(). ")";
      $conn-&gt;execute($sql);
  
              $_SESSION['EMAIL']      = $_REQUEST['email'];
  
  
      $ran=time().rand(1,99999999);
      $sql="update verify as v, signup as s set v.vcode='" .$ran. "', s.emailverified='no' WHERE v.UID=s.UID and v.UID='" .$userid. "'";
      $conn-&gt;execute($sql);
      STemplate::assign('vcode',$ran);
  
      $to         = $_SESSION['EMAIL'];
      $name       = $config['site_name'];
      $from       = $config['admin_email'];
      $rs         = $conn-&gt;execute("select * from emailinfo where email_id='verify_email'");
      $subj       = $rs-&gt;fields['email_subject'];
      $email_path     = $rs-&gt;fields['email_path'];
      $mailbody   = STemplate::fetch($email_path);
      mailing($to,$name,$from,$subj,$mailbody);
  
      $_SESSION['verification_sent'] = $lang['signup.verification_sent'];
  
      $redirect = ( isset($_SESSION['redirect']) &amp;&amp; $_SESSION['redirect'] != '' ) ? $_SESSION['redirect'] : $config['BASE_URL'];
      $_SESSION['redirect'] = NULL;
  
      session_write_close();
      header('Location: ' .$redirect);
      die();
  }
    }
  
  if ( $config['enable_package'] == 'yes' ) {
      $sql = "select * from package where status = 'Active' order by price desc";
      $rs = $conn-&gt;execute($sql);
      STemplate::assign('package', $rs-&gt;getrows());
  }
  
  STemplate::assign('err',$err);
  STemplate::assign('msg',$msg);
  STemplate::assign('head_bottom',"homelinks.tpl");
  STemplate::assign('username', $username);
  STemplate::assign('email', $email);
  STemplate::display('head1.tpl');
  STemplate::display('err_msg.tpl');
  STemplate::display('signup.tpl');
  STemplate::display('footer.tpl');
  STemplate::gzip_encode();
  ?&gt;
  </code></pre>