title: passing array data from an html form to php array variables
body: <p>I have a form to record the hours worked on a set of projects. the form uses an array for the project id, hours, and a notes field, with the form lines being a loop on the number of projects. the form passes the data to a PHP script for processing. The PHP script is not seeing the values in the array... it's just giving me "Array" as the output.</p>
  
  <p>Documentation and other examples have me wondering if I have to serialize or unserialize or something else to get things to work right, but multiple attempts have been unsuccessful.</p>
  
  <p>In the form:</p>
  
  <pre><code>&lt;form action="input-hours-do.php" method="post"&gt;
  
  &lt;table&gt;
  
  &lt;tr&gt;
  &lt;td&gt;Project&lt;/td&gt;
  &lt;td&gt;Hours&lt;/td&gt; 
  &lt;td&gt;Notes&lt;/td&gt; 
  &lt;/tr&gt;
  
  &lt;?
  
  // assign project IDs
  
  $rhprID[0] = "ABT";
  $rhprID[1] = "GHUR";
  $rhprID[2] = "TRE";
  $rhprID[3] = "WERT";
  
  // loop on the projects
  
  for ($i = 0; $i &lt; 3; $i++)
      {
      ?&gt;
  
      &lt;!-- project id is not editable --&gt;
  
      &lt;input type="hidden" name="rhprID[]" value="&lt;? echo $rhprID[$i]; ?&gt;" /&gt;
  
          &lt;tr&gt;
              &lt;td&gt;
                  &lt;?php echo $rhprID[$i] ?&gt;
              &lt;/td&gt;
  
              &lt;td&gt;
                  &lt;input type="text" name="rhHours[]" size="6" /&gt;
              &lt;/td&gt;
  
              &lt;td&gt;
                  &lt;input type="text" name="rhNotes[]" size="40" /&gt;
              &lt;/td&gt;
          &lt;/tr&gt;
  
          &lt;?
          }  // end of i for loop
  
  ?&gt;
  
  &lt;/table&gt;
  
  
  &lt;input type="submit" name="tUpdate" size="8" value="Submit Hours" /&gt;
  
  &lt;/form&gt; 
  </code></pre>
  
  <p>in the action script (input-hours-do.php):</p>
  
  <pre><code>$rhprID = $_POST['rhprID'];
  $rhHours = $_POST['rhHours'];
  $rhNotes = $_POST['rhNotes'];
  
  echo "count of prid is " . count($rhprID) . "&lt;/br&gt;";
  
  for ($k = 0; $k &lt; count($rhprID); $k++)
      {
      echo  " prID is: " . $rhprID[$k] . " hours are: " . $rhHours[$k] . " notes are: " .     $rhNotes[$k];
      }
  
  ?&gt;
  </code></pre>
  
  <p>Output from this is:</p>
  
  <blockquote>
    <p>count of rhprid is 1</p>
    
    <p>prID is: A hours are: A notes are: A</p>
  </blockquote>
  
  <p>So:</p>
  
  <ul>
  <li>it seems to think the array is only 1 element long</li>
  <li>it's not getting to the values in the array ("A" is the first letter of "Array", so its just using the string variable, not the underlying data values).</li>
  </ul>
  
  <p>What do I need to change to get to the underlying data values?</p>