title: Add multiple inputs with same name to mysql database
body: <p>I'm trying to fill my mysqli database from a form with multiple input fields with the same structure and names using ajax, but I'm pretty stuck here. I have tried several solutions but all with te same result, only my last two input fields are send to my database.</p>
  
  <p>My form looks like this;</p>
  
  <pre><code>&lt;form id="sendform" method="post" action="#"&gt;
    &lt;fieldset&gt;
      &lt;input type="text" value="JD01" id="shortname" name="member[shortname]" readonly /&gt;
      &lt;input type="text" value="John Doe" id="fullname" name="member[fullname]" readonly /&gt;
    &lt;/fieldset&gt;
    &lt;fieldset&gt;
      &lt;input type="text" value="JD02" id="shortname" name="member[shortname]" readonly /&gt;
      &lt;input type="text" value="Jane Doe" id="fullname" name="member[fullname]" readonly /&gt;
    &lt;/fieldset&gt;
    &lt;input type="submit" value="Send" /&gt;
  &lt;/form&gt;
  </code></pre>
  
  <p>The ajax part;</p>
  
  <pre><code>$('#sendform').submit(function(e){
  $.ajax({
      type: 'POST',
      url: 'inc/post.php', 
      data: $(this).serialize(),
      success: function(data){
          alert("Data Save: " + data);
      }
  });
  e.preventDefault();
  });
  </code></pre>
  
  <p>And my php;</p>
  
  <pre><code>define('HOST', 'localhost');
  define('USER', 'root');
  define('PASS', 'root');
  define('DBNAME', 'test');
  $db = new mysqli(HOST, USER, PASS, DBNAME);
  
  $values = array();
  foreach ($_POST['member'] as $member) {
      $values[] = '(' . $member['shortname'] . ',' . $member['fullname'] . ')';
  }
  $sql = "INSERT INTO sendform (shortname, fullname) VALUES " . implode(',', $values);
  $result = $db-&gt;query($sql);
  if($result) {
      echo "Yep";
  }
  $db-&gt;close();
  </code></pre>
  
  <p>What am I doing wrong here? thnx!</p>