title: posting a single dimenstion array to db ajax post
body: <p>I have this form, that loads the details using jquery load function 
  here is the form</p>
  
  <pre><code> &lt;form id="form1" name="form1" method="post" action=""&gt;
  &lt;div id="tableBg"&gt;
  &lt;table width="100%" border="0" cellspacing="0" cellpadding="0" class="list"&gt;
  &lt;thead&gt;
  &lt;tr&gt;
        &lt;th width="39%" scope="col"&gt;WHITE LIST&lt;/th&gt;
        &lt;th width="61%" scope="col"&gt;&amp;nbsp;&lt;/th&gt;
        &lt;/tr&gt;
        &lt;/thead&gt;
  &lt;/table&gt;
  
  &lt;div style="max-height:400px; overflow-y:auto"&gt;
    &lt;table width="100%" border="0" cellspacing="0" cellpadding="0" id="list"&gt;
      &lt;tr class="sub_head"&gt;
        &lt;td scope="col"&gt;&lt;strong&gt;REG. NO.&lt;/strong&gt;&lt;/td&gt;
        &lt;td scope="col"&gt;&lt;strong&gt;STUDENT NAME&lt;/strong&gt;&lt;/td&gt;
        &lt;td scope="col"&gt;&lt;strong&gt;GRADE&lt;/strong&gt;&lt;/td&gt;
        &lt;td scope="col"&gt;&lt;strong&gt;MESSAGE ID&lt;/strong&gt;&lt;/td&gt;
        &lt;/tr&gt;
      &lt;tbody&gt;&lt;/tbody&gt;
    &lt;/table&gt;
  &lt;/div&gt;
  &lt;div id="PageFooter"&gt;
   &lt;input type="submit" name="save_result" id="save_result" value="Save Results" /&gt;
  &lt;/div&gt;
  &lt;/div&gt;
  &lt;/form&gt;
  </code></pre>
  
  <p>and loads the  loads the code below from another page</p>
  
  <pre><code>do{
      ?&gt;
  &lt;tr &lt;?php echo (($x%2) != 0) ? '' : ' class="alternate-row row"' ?&gt;&gt;
    &lt;td scope="col"&gt;&lt;?php echo $learners['reg_no'];?&gt;&lt;/td&gt;
    &lt;td scope="col"&gt;&lt;?php echo $learners['surname']." ".$learners['full_names']." (".$learners['nickname'].")";?&gt;&lt;/td&gt;
    &lt;td scope="col"&gt;&lt;?php echo $learners['grd']." ".$learners['grade_section'];?&gt;&lt;/td&gt;
    &lt;td scope="col"&gt;
    &lt;input name="sms_id[&lt;?php echo $learners['reg_no']; ?&gt;]" type="text" size="3" /&gt; 
      &lt;/td&gt;
    &lt;/tr&gt;
  &lt;?php $x++;}while($learners = $getLearners-&gt;fetch());
  </code></pre>
  
  <p>this code is within a form and there is a submit button at the bottom. This for is posted to a process.php which with the following code, print's some output</p>
  
  <pre><code>if(isset($_POST['submit'])){
  
      foreach($_POST['sms_id']  as $reg=&gt;$msg_id){
          echo $reg. " / ".$msg_id;
      }
  </code></pre>
  
  <p>} </p>
  
  <p>the above displays both values if the form is posted directly from the form to process.php</p>
  
  <p>But I wanted to use ajax and tried the following code that is not working. Just posting the $msg_id but not the other value.</p>
  
  <pre><code>var formData = $("#form1").serializeArray();
              $.ajax({
                  url: "models/process.php",
                  type: "POST",
                  data: formData,
                  success: function(data)
                  {
                      alert(data);
                  }
              });
  </code></pre>
  
  <p>This code is not working can someone help? Thanks in advance.</p>
  
  <p>J D K</p>