title: How do I get multiple values from one input field in php?
body: <p>I have a form that has draggable elements that are dropped into a hidden input field.  I have a php script that gets the values and adds them to an array, which is then added to a database.  I then echo the contents of the array and the array length.  At least that's what it's supposed to do.  However, the array_push function is acting more like array_pop in that it's returning the last element added to the array and keeping the count at 1.  How would I go about looping through and finding each input value?  Sorry if the question title is vague.</p>
  
  <p><strong>HTML</strong></p>
  
  <pre><code>&lt;input type='hidden' name='findCat[]' id='findCat' value='" +cat.toUpperCase()+ "' /&gt;
  </code></pre>
  
  <p><strong>PHP</strong></p>
  
  <pre><code>if($_POST['submit'] == TRUE){
      $findCat = $_POST['findCat'];
      $emerg_array = array($findCat);
      $arrayLength = count($emerg_array);
  
      for($i = 0; $i &lt; $arrayLength; $i++){
          echo $emerg_array[$i] .'&lt;br&gt;';
      }
      echo $arrayLength;
  }
  </code></pre>
  
  <p><strong>OUTPUT</strong></p>
  
  <p>Array</p>
  
  <p>1</p>
  
  <p>Regardless of how many elements are in the array.</p>