title: send arraylist values and fetch that array value in php
body: <p>I am trying to get the values from a php file.</p>
  
  <p>I have a java file like this </p>
  
  <pre><code>ArrayList&lt;NameValuePair&gt; al = new ArrayList&lt;NameValuePair&gt;();
  
  for (int i = 0; i &lt; name.size(); i++) 
  {
      al.add(new BasicNameValuePair("names["+i+"]",String.valueOf(name.get(i))));
  
      System.out.println("arr is " +String.valueOf(name.get(i)+ "arrrr"+name.get(i)));
  }
  </code></pre>
  
  <p>Here,  <code>name</code> is an ArrayList.</p>
  
  <p>Now I want that name ArrayList to be sent to php and loop that array and insert into database</p>
  
  <p>this is my php file</p>
  
  <pre><code>$con = mysql_connect("localhost","aaa","aa");
  mysql_select_db("aa", $con);
  
  if (!$con)
  {
      die('Could not connect: ' . mysql_error());
  }
  
  $arr[] = $_POST['names[]'];
  
  foreach ($arr as $key) 
  {
      $query="insert into Orders1(names) values('$key')";
      mysql_query($query);
  }
  </code></pre>
  
  <p>it's inserting <code>""</code> (empty) value in database please help me.</p>