I think you should use $_POST instead $_REQUEST because $_REQUEST is $_POST, $_GET and $_COOKIE.
look into this sample http://www.androidsnippets.com/executing-a-http-post-request-with-httpclient On Saturday, May 12, 2012 10:22:34 PM UTC-4, Jeresam515 wrote: > > when sending data to a php server through android I cam across this error: > "Notice: Undefined index: IT in C:\xampp\htdocs\hello.php on line 4". After > a few hours of messing around with it I can't solve my issue. > > hello.php : > > <?php > mysql_connect("localhost","user","pass"); > mysql_select_db("mmo"); > $r=mysql_query("update players set X = '".$_REQUEST['IT']."' where 22=22"); > if(!$r) > echo "Error in query: ".mysql_error(); > mysql_close(); > header('Refresh: 0.01; URL=http://localhost/hello.php'); > ?> > > update method in android: > > public void UpdateSeverWithPlayer() > {List<NameValuePair> nameValuePairs = new ArrayList<NameValuePair>(); > nameValuePairs.add(new BasicNameValuePair("IT","3")); > try{ > HttpClient httpclient = new DefaultHttpClient(); > HttpPost httppost = new HttpPost("http://10.0.2.2/hello.php"); > httppost.setEntity(new UrlEncodedFormEntity(nameValuePairs)); > > HttpResponse response = httpclient.execute(httppost); > HttpEntity entity = response.getEntity(); > is = entity.getContent(); > }catch(Exception e){ > Log.e("log_tag", "Error in http connection"+e.toString()); > }} > > I am working on the android emulator and do have the internet permission. > As always help is greatly appreciated. EDIT 1: It appears the issue is in > the android and not the php code. > > -- 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

