title: How to insert data in mysql table after jQuery validation
body: <p>I have used jquery to validate my form data. As shown bellow:</p>
  
  <pre><code>&lt;form method="post" id="register-form" novalidate&gt;
  &lt;table width='100%&gt;
  &lt;tr class="dark"&gt;
  &lt;td&gt; &lt;strong&gt;Event Date:&lt;/strong&gt; &lt;/td&gt;
  &lt;td&gt; &lt;input type="date" name="event_date" id="event_date"&gt; &lt;/td&gt;
  &lt;/tr&gt;
  
  &lt;tr class="light"&gt;
  &lt;td&gt; &lt;strong&gt; Description &lt;/strong&gt; &lt;/td&gt;
  &lt;td&gt; &lt;input type="text" name="event_desc" id="event_desc"/&gt; &lt;/td&gt;
  &lt;/tr&gt;
  
  &lt;tr class="dark"&gt;
  &lt;td&gt; &lt;strong&gt; Year &lt;/strong&gt; &lt;/td&gt;
  &lt;td&gt; &lt;input type="text" name="year" id="year"/&gt; &lt;/td&gt;
  &lt;/tr&gt;
  
  &lt;/table&gt;
  
  &lt;input type='submit' name='add' value='Save Event'&gt;
  &lt;/form&gt;
  
  
  &lt;link href="//netdna.bootstrapcdn.com/twitter-bootstrap/2.3.2/css/bootstrap-combined.no-icons.min.css" rel="stylesheet"&gt;
  &lt;script src="//netdna.bootstrapcdn.com/twitter-bootstrap/2.3.2/js/bootstrap.min.js"&gt;&lt;/script&gt;
  
  &lt;link href="runnable.css" rel="stylesheet" /&gt;
  &lt;!-- Load jQuery and the validate plugin --&gt;
  &lt;script src="//code.jquery.com/jquery-1.9.1.js"&gt;&lt;/script&gt;
  &lt;script src="//ajax.aspnetcdn.com/ajax/jquery.validate/1.9/jquery.validate.min.js"&gt;&lt;/script&gt;
  
  &lt;!-- jQuery Form Validation code --&gt;
    &lt;script&gt;
  
    // When the browser is ready...
    $(function() {
  
      // Setup form validation on the #register-form element
      $("#register-form").validate({
  
          // Specify the validation rules
          rules: {
              event_date: "required",
              event_desc: "required",
              event_date: {
                  required: true,
              },
  
          },
  
          // Specify the validation error messages
          messages: {
              event_date: "Please select a date",
              event_desc: "Please enter event description",
          },
  
          submitHandler: function(form) {
              form.submit();
          }
      });
  
    });
  
    &lt;/script&gt;
  </code></pre>
  
  <p>Now my question is when the validation finishes where can I use the Insert query to insert the form data in my table. I am talking about this query:</p>
  
  <pre><code>&lt;?php
  if(isset ($_POST['add']))
  {
       mysql_query("INSERT into events (event_date, event_desc, year)   
                      VALUES('".$_POST['event_date']."',
                             '".$_POST['event_desc']."',
                             '".$_POST['year']."') ");
  
         echo "&lt;script&gt; alert('1 Record inserted!') &lt;/script&gt;"; 
  }
  </code></pre>
  
  <p>So can someone help me how to do it?</p>