title: Post an array from Javascript to PHP
body: <p>I have an array in Javascript that i am trying to pass to php.  my array looks like this.  </p>
  
  <pre><code> Array[0]
     "empNo" : "1347"
     "empName" : "John Doe"  
  </code></pre>
  
  <p>I am building this array from this javascript:</p>
  
  <pre><code>$('input[type=text]').each(function()
  {
               if ($(this).attr("value").length&gt;0)
               {
                    param[$(this).attr("id")]=$(this).attr("value");
               }            
  });
  </code></pre>
  
  <p>Then I pass the array to php using</p>
  
  <pre><code>$.post("example.php",param)
  </code></pre>
  
  <p>Then in php when I try to interact with the post like this:</p>
  
  <pre><code>$emp=$_POST['empNo'];
  $name=$_POST['empName'];
  echo ($_GET[0]);//this is for testing 
  </code></pre>
  
  <p>It throws an error saying that <code>The Indexes of empNo and empName are not Defined</code>. </p>
  
  <p>It also says that <code>0 is an undefined offset</code>.<br>
  Thanks for the help</p>