title: Validate form fields and write to database on successful completion
body: <p>I wrote a little script with jQuery. With this script you can get more "steps" if you click on the button "einen Schritt hinzufügen". </p>
  
  <p>Now when I press the button "erstellen", I want to check if all the fields are filled and if successful, write the data into a database. </p>
  
  <p>How can I connect PHP with jQuery, after jQuery validation of the fields is completed?</p>
  
  <p>Here is the example page: </p>
  
  <p><a href="http://localhost/Design_neu/index.php?content=create_tutorial" rel="nofollow">MyPage</a></p>
  
  <p>And here is the code (without CSS):</p>
  
  <p><div class="snippet" data-lang="js" data-hide="false">
  <div class="snippet-code">
  <pre class="snippet-code-html lang-html prettyprint-override"><code>&lt;section&gt;
      &lt;article&gt;
          &lt;div class="step"&gt;
              &lt;div class="header_step"&gt;Erstelle dein eigenes Tutorial&lt;/div&gt;
              &lt;div class="body_step"&gt;Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua. At vero eos et accusam et justo duo dolores et ea rebum. Stet clita kasd gubergren, no sea takimata sanctus est Lorem ipsum dolor sit amet. Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua. At vero eos et accusam et justo duo dolores et ea rebum. Stet clita kasd gubergren, no sea takimata sanctus est Lorem ipsum dolor sit amet.&lt;/div&gt;
          &lt;/div&gt;
          &lt;form method="post" action="index.php?content=create_tutorial"&gt;
          &lt;div class="step"&gt;
              &lt;div class="header_step"&gt;Allgemeines zum Tutorial&lt;/div&gt;
              &lt;div class="body_step"&gt;
                  &lt;a class="create_tutorial_a"&gt;Titel des Tutorial's&lt;/a&gt;&lt;input class="create_tutorial_input"/&gt;
                  &lt;br&gt;
                  &lt;a class="create_tutorial_a"&gt;Autor des Tutorial's&lt;/a&gt;&lt;input class="create_tutorial_input"/&gt;
                  &lt;br&gt;&lt;br&gt;
                  &lt;a class="create_tutorial_a_full_width"&gt;Beschreibung des Schrittes&lt;/a&gt;
                  &lt;br&gt;
                  &lt;textarea class="create_tutorial_textarea"&gt;&lt;/textarea&gt;
              &lt;/div&gt;
          &lt;/div&gt;
          
          &lt;div class="all_steps"&gt;
              
          &lt;/div&gt;
          
          &lt;div class="step"&gt;
              &lt;div class="body_step"&gt;
                  &lt;button class="create_button" type="submit" name="submit"&gt;Erstellen&lt;/button&gt;
                  &lt;input type="button" class="create_button" id="add_step" value="Schritt hinzufügen"/&gt;
                  &lt;input type="button" class="create_button" id="remove_step" value="Schritt entfernen"/&gt;
              &lt;/div&gt;
          &lt;/div&gt;
          &lt;/form&gt;
          
      &lt;/article&gt;
      &lt;div class="clearBoth"&gt;&lt;/div&gt;
  &lt;/section&gt;
  
  
  
  &lt;script&gt;
      $(document).ready(function() {
      var max_fields      = 10; //maximum input boxes allowed
      var wrapper         = $(".all_steps"); //Fields wrapper
      var add_button      = $("#add_step"); //Add button ID
      var remove_step     = $("#remove_step");
      
      var x = 0; //initlal text box count
      $(add_button).click(function(){ //on add input button click
          if(x &lt; max_fields){ //max input box allowed
              $(wrapper).append('&lt;div class="step"&gt;&lt;div class="header_step"&gt;Schritt '+ (x + 1) +' des Tutorial\'s&lt;/div&gt;&lt;div class="body_step"&gt;&lt;a class="create_tutorial_a"&gt;Titel des Schrittes&lt;/a&gt;&lt;input name="input_title_name'+x+'" class="create_tutorial_input" /&gt;&lt;br&gt;&lt;a class="create_tutorial_a"&gt;Bild&lt;/a&gt;&lt;input type="file" /&gt;&lt;br&gt;&lt;br&gt;&lt;a class="create_tutorial_a_full_width"&gt;Beschreibung des Schrittes&lt;/a&gt;&lt;br&gt;&lt;textarea class="create_tutorial_textarea" name="input_description_name'+x+'"&gt;&lt;/textarea&gt;&lt;/div&gt;');
              x++; //text box increment
          }
      });
     
      $(remove_step).click(function(){ //user click on remove text
          $('.all_steps .step:last').remove();
          x--;
      })
  });
  &lt;/script&gt;</code></pre>
  </div>
  </div>
  </p>