title: Get Data entered in modal to save In Database
body: <p>I am a noob in web development so I am stuck at getting data from a modal and saving it to database.
  I have made model with bootstrap. Below is the code of the modal</p>
  
  <hr>
  
  <h2>code of modal</h2>
  
  <pre><code>    &lt;form name="form" action="post" method=""&gt;
  &lt;button type="button" class="btn btn-info btn-lg" data-toggle="modal" data-target="#myModal"&gt;Add part&lt;/button&gt;
  &lt;/form&gt;
  
  &lt;div id="myModal" class="modal fade" role="dialog"&gt;
    &lt;div class="modal-dialog"&gt;
  
      &lt;!-- Modal content--&gt;
      &lt;div class="modal-content"&gt;
        &lt;div class="modal-header"&gt;
          &lt;button type="button" class="close" data-dismiss="modal"&gt;&amp;times;&lt;/button&gt;
          &lt;h4 class="modal-title"&gt;Add parts&lt;/h4&gt;
        &lt;/div&gt;
        &lt;div class="modal-body"&gt;
        &lt;input type="text" name="field1" placeholder="Part Name" id="pName" /&gt;
        &lt;br&gt;
        &lt;br&gt;
        &lt;input type="text" name="field2" placeholder="Piece Code" /&gt;
        &lt;br&gt;
        &lt;br&gt;
        &lt;input type="text" name="field3" placeholder="Piece Price" /&gt;
        &lt;br&gt;
        &lt;br&gt;
  
        &lt;input type="text" name="field4" placeholder="Quatity" /&gt;
        &lt;br&gt;
        &lt;br&gt;
        &lt;input type="text" name="field5" placeholder="Total" /&gt;
        &lt;br&gt;
        &lt;br&gt;
        &lt;input type="text" name="field6" placeholder="Comments" /&gt;
        &lt;br&gt;
        &lt;br&gt;
        &lt;input type="text" name="field7" placeholder="Shipped" /&gt;
        &lt;br&gt;
        &lt;br&gt;
  
        &lt;/div&gt;
        &lt;div class="modal-footer"&gt;
          &lt;button onclick="saveit()" type="button" name="saveBtn" class="btn btn-default" data-dismiss="modal"&gt;save&lt;/button&gt;
      &lt;/div&gt;
      &lt;/div&gt;
      &lt;/div&gt;
  &lt;/div&gt;
  </code></pre>
  
  <p>What I am trying to accomplish is get the data entered in this popup modal save it in database by pressing save button in the modal and clear the pop so that user can enter data again. I want to save the data by using PHP Query .Kindly suggest me a way to get it done . I have seen a lot of tutorials and almost every question on stack overflow as well but I am unable to get it done.</p>