=================================================================
HttpClient httpclient = new DefaultHttpClient();
HttpPost httppost = new HttpPost("http://10.0.2.2/pt.php");
try {
List<NameValuePair> nameValuePairs = new
ArrayList<NameValuePair>(2);
nameValuePairs.add(new BasicNameValuePair("id", "12345"));
nameValuePairs.add(new BasicNameValuePair("name", "Sarwar
Erfan"));
httppost.setEntity(new
UrlEncodedFormEntity(nameValuePairs));
HttpResponse response = httpclient.execute(httppost);
String responseText =
EntityUtils.toString(response.getEntity());
Toast.makeText(this, responseText , 5000).show();
}
catch (ClientProtocolException e) {
}
catch (IOException e) {
}
=================================================================
Dont forget to add the INTERNET permission
<uses-permission android:name="android.permission.INTERNET" />
Regards
Sarwar Erfan
On Nov 9, 7:42 pm, Avraam Mauridis <[email protected]> wrote:
> Hi , i have the following php script, i want to pass parametrs from
> android to script and execute it, can you help me?
>
> <?php
> $handle = mysql_connect('localhost','root','');
> if($handle==false)
> {
> die('No database connection');}
>
> $db=mysql_select_db('test');
>
> $query='INSERT INTO people (id,name) VALUES ("'.$_POST["id"].'" ,"'.
> $_POST["name"].'" )';
> $result=mysql_query($query);
>
> ?>
--
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en