Post some values to Php and store in database using HTTP, stores empty values only
<p>I have tried to send some values to Php file in server using Http post...It store only empty values in Fields of my mysql database....please help me...</p>

<p><strong>My Android coding:</strong></p>

<pre><code>private void sendValues()
                {
                  List&lt;NameValuePair&gt; data= new ArrayList&lt;NameValuePair&gt;(2);
                  data.add(new BasicNameValuePair("number", "123456789"));
                  data.add(new BasicNameValuePair("msg", "haiRam"));



                  try {

                    HttpClient httpclient=new DefaultHttpClient();

                      HttpPost httppost=new HttpPost("http://www.mywebsite.com/fasttrack/HttpTest.php");

                      httppost.setEntity(new UrlEncodedFormEntity(data));

                      HttpResponse rs=httpclient.execute(httppost);

                } catch (UnsupportedEncodingException e) {
                    // TODO Auto-generated catch block
                    e.printStackTrace();

                } catch (ClientProtocolException e) {
                    // TODO Auto-generated catch block
                    e.printStackTrace();

                } catch (IOException e) {
                    // TODO Auto-generated catch block
                    e.printStackTrace();

                }
</code></pre>

<p><strong>my Php coding:</strong></p>

<pre><code>&lt;?php
// Gets data from URL parameters
$mobile=$_GET['number'];
$message = $_GET['msg'];


echo $message;
echo $mobile;


$connection=mysql_connect ("mysql", "user", "pass");
if (!$connection) {
  die('Not connected : ' . mysql_error());
}

// Set the active MySQL database
$db_selected = mysql_select_db("gps", $connection);
if (!$db_selected) {
  die ('Can\'t use db : ' . mysql_error());
}

// Insert new row with user data
$query = sprintf("INSERT INTO Http" .
         " (mobile,mess) " .
         " VALUES ('%s', '%s');",
         mysql_real_escape_string($mobile),
         mysql_real_escape_string($message));

$result = mysql_query($query);

if (!$result) {
  die('Invalid query: ' . mysql_error());
}
?&gt;
</code></pre>
