title: How to store data to MySQL for array input
body: <p>Hope my question is correct to the post.</p>
  
  <pre><code>  &lt;form action="process.php?id=&lt;?php echo intval($order['id']);?&gt;" method="post"&gt;
    &lt;ul&gt;
    &lt;?php
    $sd = 'SELECT * FROM download WHERE pid IN ('.$order['pid'].') ORDER BY pid ASC'; // pid IN (3,4,5)
    $qd = $db-&gt;rq($sd);
    $no = 1; while($download = $db-&gt;fetch($qd)) {
    ?&gt;
    &lt;li&gt;
    &lt;?php echo $no; ?&gt; &lt;?php echo $download['title']; ?&gt;
    &lt;input type="hidden" name="mid[]" value="&lt;?php echo $order['mid']; ?&gt;" /&gt;
    &lt;input type="hidden" name="pid[]" value="&lt;?php echo $download['pid']; ?&gt;" /&gt;
    &lt;/li&gt;
    &lt;?php $no++; } ?&gt;
    &lt;/ul&gt;
    &lt;input type="submit" name="submit" value="Submit" /&gt; 
    &lt;/form&gt;
  </code></pre>
  
  <p><strong>Output</strong></p>
  
  <ol>
  <li>Sony Ericsson Drivers</li>
  <li>Sony Ericsson Apps</li>
  <li>Samsung Drivers</li>
  <li>Motorola Drivers</li>
  </ol>
  
  <p><strong>Question</strong></p>
  
  <ol>
  <li>How to store (save) the data <code>Output</code> to table structure at below on <code>process.php</code></li>
  <li><p>Data will be save something like these.</p>
  
  <pre><code>id | mid | pid | title
  -----------------------------------------
  1  |  1  |  3  |  Sony Erricson Drivers
  -----------------------------------------
  2  |  1  |  3  |  Sony Erricson Apps
  -----------------------------------------
  3  |  1  |  4  |  Samsung Drivers
  -----------------------------------------
  4  |  1  |  5  |  Motorola Drivers  
  -----------------------------------------
  </code></pre></li>
  </ol>
  
  <p><strong>process.php</strong>  </p>
  
  <pre><code>if (isset($_POST['submit']) &amp;&amp; !empty($_POST['submit'])) {
  // I'm blur how to get dynamic mid[] &amp; pid[] here
  }
  </code></pre>