title: Inserting Multiple Rows by Form into a Single DB
body: <p>First time doing this, watch it be a really obvious/easy fix...</p>
  
  <p>Basically I'm trying to insert multiple rows with a single insert query, however, I clearly fail and as such it wont work.</p>
  
  <p>The form is generated by searching a table for the relevant entries it relates to, so if your in department A it will grab your name and form an input line on the form. This all works fine I can generate the form however the issue them comes when I try to insert the form.</p>
  
  <p>Currently it does this thing where rather than inserting the data entered via the form it is entering the letter A across most fields (COUNT, STATUS and TYPE are immune to this as they are restricted to only certain data types via the tables set up itself).</p>
  
  <p>This is currently how I have the form set in the script:</p>
  
  <pre><code>&lt;?php
  if ($action == "editrecord") {
  ?&gt;
  &lt;form name="form1" method="post" action=""&gt;
  &lt;table&gt;
  &lt;tr&gt;&lt;td colspan="2" align="left"&gt;
  &lt;?php //Getting Title for Record
          $resultTITLE = queryDB("SELECT * FROM merit_subdepts WHERE subdeptID = '$subdeptID'");
          while($rowTITLE = mysql_fetch_array($resultTITLE)) {
          $recordTITLE = $rowTITLE["subdeptNAME"];
              echo "$recordTITLE";
          }
  ?&gt;
  &lt;/td&gt;&lt;/tr&gt;
  &lt;tr&gt;&lt;td&gt;Member Name&lt;/td&gt;&lt;td&gt;Choose Award&lt;/td&gt;&lt;td&gt;Reason&lt;/td&gt;&lt;td&gt;&lt;/td&gt;&lt;/tr&gt;
  &lt;?php
          $resultMERIT = queryDB("SELECT * FROM merit_members WHERE memberPRIMARY = '$subdeptID'");
          while($rowMERIT = mysql_fetch_array($resultMERIT)) {
          $memberID = $rowMERIT["memberID"];  
          $memberNAME = $rowMERIT["memberNAME"];
              ?&gt;
              &lt;tr&gt;
                  &lt;td&gt;&lt;?php echo $memberNAME; ?&gt;&lt;/td&gt;
                  &lt;td&gt;&lt;select name="count[]" class="ui-state-default"&gt;
                          &lt;option value="0"&gt;0&lt;/option&gt;
                          &lt;option value="1"&gt;1&lt;/option&gt;
                          &lt;option value="2"&gt;2&lt;/option&gt;
                          &lt;option value="3"&gt;3&lt;/option&gt;
                          &lt;option value="4"&gt;4&lt;/option&gt;
                          &lt;option value="5"&gt;5&lt;/option&gt;
                          &lt;option value="6"&gt;6&lt;/option&gt;
                      &lt;/select&gt;
                  &lt;/td&gt;
                  &lt;td&gt;&lt;input name="reason[]" type="text" id="reason" class="blackInput" value="Monthly Award &lt;?php echo date("F, Y") ?&gt;"&gt;&lt;/td&gt; 
                  &lt;td&gt;&lt;input name="type[]" type="hidden" id="type" value="Civil"&gt;
                      &lt;input name="awarder[]" type="hidden" id="awarder" value="&lt;?php $usersname; ?&gt;"&gt;
                      &lt;input name="datea[]" type="hidden" id="datea" value="&lt;?php $stamp83; ?&gt;"&gt;
                      &lt;input name="status[]" type="hidden" id="status" value="Check"&gt;
                      &lt;input name="id[]" type="hidden" id="id" value"&lt;?php $memberID; ?&gt;"&gt;
                      &lt;input name="dept[]" type="hidden" id="dept" value"&lt;?php $recordTITLE; ?&gt;"&gt;
                  &lt;/td&gt;
              &lt;/tr&gt;
  
          &lt;?php } //end of sub-division membership list ?&gt;
  &lt;tr&gt;&lt;td colspan="4"&gt;&lt;center&gt;
         &lt;div class="butDiv"&gt;&lt;input name="submitRECORDS" type="submit" id="submitRECORDS" value="Submit Records"&gt;&lt;/div&gt;
         &lt;/center&gt;
       &lt;/td&gt;
    &lt;/tr&gt;
  &lt;/table&gt;
  &lt;/form&gt;
  &lt;?php
  } //End of Edit Merit Records
  ?&gt;
  </code></pre>
  
  <p>This is the insert query used:</p>
  
  <pre><code>if ($submitRECORDS) {
  
  for($i = 0; $i&lt;count($_POST['id']); $i++) //Getting total # var submitted and running loop 
  { $fromID = $_POST['id'][$i]; //var
    $fromTYPE = $_POST['type'][$i]; //var
    $fromCOUNT = $_POST['count'][$i]; //var
    $fromDATEA = $_POST['datea'][$i]; //var
    $fromAWARDER = $_POST['awarder'][$i]; //var
    $fromREASON = $_POST['reason'][$i]; //var
    $fromDEPT = $_POST['dept'][$i]; //var
    $fromSTATUS = $_POST['status'][$i]; //var
  if ($fromID != "0") { 
  queryDB("INSERT INTO merit_precord (NAME,TYPE,COUNT,DATEA,AWARDER,REASON,DEPT,STATUS) VALUES ('$fromID','$fromTYPE','$fromCOUNT','$fromDATEA','$fromAWARDER','$fromREASON','$fromDEPT',$fromSTATUS')"); } }
  $action="";
  $msg=1;
  }
  </code></pre>
  
  <p>Assistance much appreciated before I rip my hair out. :)</p>