title: Getting hidden input values with PHP
body: <p>I'm doing something confusing and that should work, but isn't.  I'm having an issue getting the value of a hidden input field and being able to see it using PHP.  I can't give the actual project, but I'll provide an example.</p>
  
  <p><strong>HTML</strong></p>
  
  <pre><code>&lt;td&gt;&lt;input type='hidden' id=emerg_desc value=emerg_desc /&gt;emerg_desc&lt;/td&gt;
  </code></pre>
  
  <p><code>emerg_desc</code> is a javascript variable that dynamically changes when the user interacts with the drag and drop feature.  It's what the text is after they drop it.  Now, since it's in an input field, I should be able to get the value and pass it to a PHP variable when the user hits submit.</p>
  
  <p><strong>PHP</strong></p>
  
  <pre><code>if($_POST['submit'] == TRUE){
      function secure($data){
          $data = trim($data);
          $data = stripslashes($data);
          $data = htmlspecialchars($data);
          return($data);
      }
  
      $array = array();
      $desc = secure($_POST['emerg_desc']);
      array_push($array, $desc);
      $arrayLength = count($array);
  }
  </code></pre>
  
  <p>When I call <code>$arrayLength</code> and echo it out, I actually get the correct return value of the array, which is 1.  However, when I try to echo the contents of the array, I get nothing.  It's like the value is populating the array, but that value is an empty string.  Why's this happening?</p>
  
  <p><strong>FOR LOOP FOR THE ARRAY</strong></p>
  
  <pre><code>echo $arrayLength;
  for($i = 0; $i &lt; $arrayLength; $i++){
      echo $array[$i] .'&lt;br&gt;';
  }
  </code></pre>
  
  <p>I'm even having this problem when I change the input type to text and set the CSS display to none.  Sorry I'm not able to show a pen or fiddle of the actual project, it's not something I can legally share.</p>