title: Insert Multidimensional Array into Database with PHP
body: <p>how can I insert this array into my database? supposing I already have a database?</p>
  
  <pre><code>&lt;?php
  
  if(isset($_POST['myname'], $_POST['myage'], $_POST['mygen']) === true){
  </code></pre>
  
  <blockquote>
    <p>//this is the code where I set the keys and values</p>
  </blockquote>
  
  <pre><code>$array = array($_POST['myname'], $_POST['myage'], $_POST['mygen']);
  
  foreach ($array as $i =&gt; $values) {
      print "&lt;pre&gt;$i {\n";
      foreach ($values as $key =&gt; $value) {
          print "    $key =&gt; $value\n";
      }
      print "}\n&lt;/pre&gt;";
  }
  }
  
  
  
  
  ?&gt;
  &lt;html&gt;
      &lt;head&gt;
      &lt;script type="text/javascript" &gt;
  function CreateTextbox() 
  </code></pre>
  
  <blockquote>
    <p>//I generate textbox dynamically by this code</p>
  </blockquote>
  
  <pre><code>{
  createTextbox.innerHTML = createTextbox.innerHTML +"Name: &lt;input type='text' name='myname[]' /&gt;&lt;br&gt;"
  +"Age: &lt;input type='text' name='myage[]' /&gt;&lt;br&gt;"
  +"Gender: &lt;input type='text' name='mygen[]' /&gt;&lt;br&gt;" 
  }
      &lt;/script&gt;
      &lt;/head&gt;
      &lt;body&gt; 
          &lt;form action="" method="post"&gt;
              &lt;div id="createTextbox"&gt;&lt;/div&gt;
              &lt;input type="button" value="clickHere" onClick="CreateTextbox()" /&gt;
              &lt;input type="submit" value="Submit" name="submit" /&gt;
          &lt;/form&gt;
      &lt;/body&gt;
  &lt;/html&gt;
  </code></pre>
  
  <p>please help :(</p>