I'm trying post data on PHP server through HTML using this HTML code.
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title></title>
</head>
<body>
<form action="http://localhost:/" method="post">
<input type="hidden" value="Expence Description" id="ExpenceDescription" name="ExpenceDescription" />
<input type="hidden" value="DA, TA, Others" id="Descriptions" name="Descriptions" />
<input type="hidden" value="100, 101, 102" id="Amounts" name="Amounts" />
<input type="submit" value="Submit" />
</form>
</body>
</html>
This is my android code:
HttpClient httpclient = new DefaultHttpClient();
HttpPost httppost = new HttpPost(URL);
List<NameValuePair> nameValuePairs = new ArrayList<NameValuePair>(2);
nameValuePairs.add(new BasicNameValuePair("ExpenceDescription", "'" + expenses_head + "'"));
nameValuePairs.add(new BasicNameValuePair("Descriptions", "'" + total_desc + "'"));
nameValuePairs.add(new BasicNameValuePair("Amounts", "'" + total_amount + "'"));
httppost.setEntity(new UrlEncodedFormEntity(nameValuePairs));
HttpResponse response = httpclient.execute(httppost);
HttpEntity entity = response.getEntity();
//HttpResponse response = httpclient.execute(httppost);
StatusLine statusLine = response.getStatusLine();
The problem is that I'm getting internal server error 500 on response line.