title: How to create a jquery function to prevent duplicate entries to the database
body: <p>I have created a form which takes the data and inserts it in the database. onlick of create  button i want the function to check database whether the entry with employee_id already exists. if exists i want it to display the data already exists do you still want to insert, i am noob in this can anybody help me with this. the form is</p>
  
  <pre><code>&lt;form id="myForm" name="myForm" action='insert.php' method='post' &gt;
      &lt;input type='hidden' name='st' value=0&gt;
      &lt;table  style="text-align:center; width:100%"&gt;
          &lt;tr&gt;
              &lt;td style="text-align:right"&gt;&lt;label&gt;Select SE/AE:&lt;/label&gt;&lt;/td&gt;
              &lt;td style="text-align:left"&gt;
                  &lt;?php include("configs.php");
                  $sql = "SELECT DISTINCT seae FROM se_ae ";?&gt;
                  &lt;select name="seae"&gt;
                      &lt;option value="" selected&gt;&lt;/option&gt;
                      &lt;?php foreach ($dbo-&gt;query($sql) as $row) { ?&gt;
                          &lt;option value="&lt;?php echo $row['seae']; ?&gt;"&gt;
                          &lt;?php echo $row['seae']; ?&gt;&lt;/option&gt; 
                      &lt;?php }?&gt;
                  &lt;/select&gt;
              &lt;/td&gt;
          &lt;/tr&gt;
          &lt;tr&gt;
              &lt;td style="text-align:right"&gt;&lt;label&gt;Select Brand:&lt;/label&gt;&lt;/td&gt;
              &lt;td style="text-align:left"&gt; 
                  &lt;?php //include("configs.php"); 
                  $sql = "SELECT DISTINCT `brand` FROM se_ae ";?&gt;
                  &lt;select name="brand"&gt;
                      &lt;option value="" selected&gt; &lt;/option&gt;
                      &lt;?php foreach ($dbo-&gt;query($sql) as $row) { ?&gt;
                          &lt;option value="&lt;?php echo $row['brand']; ?&gt;"&gt;
                          &lt;?php echo $row['brand']; ?&gt;&lt;/option&gt; 
                      &lt;?php }?&gt;
                  &lt;/select&gt;
              &lt;/td&gt;
          &lt;/tr&gt;
          &lt;tr&gt;
              &lt;td style="text-align:right"&gt;&lt;label&gt;Select Territory:&lt;/label&gt;&lt;/td&gt;
              &lt;td style="text-align:left"&gt;
                  &lt;?php //include("configs.php");
                  $sql = "SELECT DISTINCT `territory` FROM se_ae ";?&gt;
                  &lt;select name="territory"&gt; 
                      &lt;option value="" selected&gt;&lt;/option&gt;
                      &lt;?php foreach ($dbo-&gt;query($sql) as $row) { ?&gt;
                          &lt;option value="&lt;?php echo $row['territory']; ?&gt;"&gt;
                          &lt;?php echo $row['territory']; ?&gt;&lt;/option&gt; 
                      &lt;?php }?&gt;
                  &lt;/select&gt;
              &lt;/td&gt;
          &lt;/tr&gt;
          &lt;tr&gt;
              &lt;td style="text-align:right"&gt;&lt;label for="name"&gt;Employee Name:&lt;/label&gt;&lt;/td&gt;
              &lt;td style="text-align:left"&gt;
                  &lt;input type="text" id="name"  name="name"/&gt;
              &lt;/td&gt;
          &lt;/tr&gt;
          &lt;tr&gt;
              &lt;td style="text-align:right"&gt;&lt;label for="number"&gt;Employee ID:&lt;/label&gt;&lt;/td&gt;
              &lt;td style="text-align:left"&gt;
                  &lt;input type="text" id="number" name="number"  /&gt;
              &lt;/td&gt;
          &lt;/tr&gt;
          &lt;tr&gt;
              &lt;td style="text-align:right"&gt;&lt;label for="email"&gt; Email:&lt;/label&gt;&lt;/td&gt;
              &lt;td style="text-align:left"&gt;
                  &lt;input type="text" id="email"   name="email"  /&gt;
              &lt;/td&gt;
          &lt;/tr&gt;
          &lt;tr&gt;
              &lt;td style="text-align:right"&gt;&lt;label for="contact"&gt; Contact:&lt;/label&gt;&lt;/td&gt;
              &lt;td style="text-align:left"&gt;
                  &lt;input type="text" id="contact"  name="contact"  /&gt;
              &lt;/td&gt;
          &lt;/tr&gt;
          &lt;tr&gt;
              &lt;td style="text-align:right"&gt;&lt;label for="exist"&gt; Exist:&lt;/label&gt;&lt;/td&gt;
              &lt;td style="text-align:left"&gt;
                  &lt;input type="radio" id="exist"  name="exist" value="Active"/&gt;Active 
                  &lt;input type="radio" id="exist"  name="exist" value="NA"/&gt;NA
              &lt;/td&gt;
          &lt;/tr&gt;
          &lt;tr&gt;
              &lt;td style="text-align:right" class='swMntTopMenu'&gt;
                  &lt;input style="background-color:rgb(255,213,32)"  name="Reset" type="reset" value="Reset"&gt;
              &lt;/td&gt;
              &lt;td style="text-align:left" class='swMntTopMenu'&gt;
                  &lt;input style="background-color:rgb(255,213,32)"  name="submit" type="submit" value="Create"&gt;
              &lt;/td&gt;
          &lt;/tr&gt;
      &lt;/table&gt;
  &lt;/form&gt;
  </code></pre>