title: Sending data from java to php file
body: <p>I want to post this data in database through php file. Right now, Username,Company , Shares and Date are posted in database. I want to post "Edward", "AHCL", "10" and "23-04-2015"</p>
  
  <pre><code>public void Insert(View view){
  
            String UserName="Edward";
  
           //String Company = company.getText().toString();
           // Shares = shares.getText().toString();
           // String Date = date.getText().toString();
  
            String Company = "AHCL";
            String Shares= "10";
            String Date= "23-04-2015";
  
  
        try {
              // open a connection to the site
              URL url = new URL("http://10.0.2.2:8080//test/example.php");
              URLConnection con = url.openConnection();
              // activate the output
              con.setDoOutput(true);
              PrintStream ps = new PrintStream(con.getOutputStream());
              // send your parameters to your site
              ps.print("&amp;Username=Username");
              ps.print("&amp;Company=Company");               
              ps.print("&amp;Shares=Shares");
              ps.print("&amp;Date=Date");
  
              // we have to get the input stream in order to actually send the request
              con.getInputStream();
  
              // close the print stream
              ps.close();
              } catch (MalformedURLException e1) {
                  e1.printStackTrace();
              } catch (IOException e2) {
                  e2.printStackTrace();
              }
  
  
  
  
  
  
  
           // creating new product in background thread
           //new CreatePortfolio().execute();
       }
  </code></pre>