title: Jquery Date picker can't saving in database by php
body: <p>This is my total code but problem is i can't insert data in database reason date-picker .With out date-picker it's insert successfully in database and when total table is empty then it's insert successfully for 1st time but other time it doesn't insert any thing. please any one help me ?    </p>
  
  <hr>
  
  <pre><code>CREATE TABLE IF NOT EXISTS `teacher` (
    `id` int(11) NOT NULL AUTO_INCREMENT,
    `name` varchar(50) NOT NULL,
    `father_name` varchar(50) NOT NULL,
    `mother_name` varchar(50) NOT NULL,
    `address` text NOT NULL,
    `sex` varchar(50) NOT NULL,
    `position` varchar(150) NOT NULL,
    `subject` varchar(150) NOT NULL,
    `sallary` int(50) NOT NULL,
    `dtime` date NOT NULL,
    PRIMARY KEY (`id`),
    UNIQUE KEY `position` (`position`)
  ) ENGINE=InnoDB  DEFAULT CHARSET=latin1 AUTO_INCREMENT=69 ;
  </code></pre>
  
  <hr>
  
  <p>
  
  <pre><code>if (isset($_POST['formsubmitted'])) {
  
      if (isset($_POST['name'])&amp;&amp;isset($_POST['f_name'])&amp;&amp;isset($_POST['m_name'])&amp;&amp;isset($_POST['dtime'])&amp;&amp;
          isset($_POST['sex'])&amp;&amp;isset($_POST['address'])&amp;&amp;isset($_POST['position'])&amp;&amp;isset($_POST['subject'])
          &amp;&amp;isset($_POST['salary'])) {
  
          $name = $_POST['name'];
          $father =$_POST['f_name'];
          $mother =$_POST['m_name'];
          $sex =$_POST['sex'];
          $address =  $_POST['address'];
          $position = $_POST['position'];
          $subject    =   $_POST['subject'];
          $salary =   $_POST['salary'];
          $dtime = date('Y-m-d',strtotime($_POST['dtime']));
  
          if (!$dtime) {
              echo $dtime;
          }else{
              $query = "INSERT INTO teacher (name, father_name, mother_name, address, sex, position, subject, salary,dtime)VALUES('$name','$father','$mother','$address','$sex','$position','$subject','$salary',$dtime)";     
              $query_run = mysqli_query($db,$query);
              if ($query_run) {
                  echo 'success!';
  
              } else {
                  echo "try again";
              }
          }
      }
  }
  </code></pre>
  
  <p>HTML:</p>
  
  <pre><code>&lt;hr&gt;
  &lt;!doctype html&gt;
  &lt;html lang="en"&gt;
  &lt;head&gt;
  &lt;meta charset="utf-8"&gt;
  &lt;title&gt;jQuery UI Datepicker - Default functionality&lt;/title&gt;
  &lt;link rel="stylesheet" href="http://code.jquery.com/ui/1.10.3/themes/smoothness/jquery-ui.css"&gt;
  &lt;script src="http://code.jquery.com/jquery-1.9.1.js"&gt;&lt;/script&gt;
  &lt;script src="http://code.jquery.com/ui/1.10.3/jquery-ui.js"&gt;&lt;/script&gt;
  &lt;link rel="stylesheet" href="style.css"&gt;
  &lt;script&gt;
  $(function() {
  $( "#datepicker" ).datepicker();
  });
  &lt;/script&gt;
  &lt;/head&gt;
  &lt;form action="teacher_sallary.php" method="POST"&gt;
      Name:&lt;br&gt;
      &lt;input type="text" name='name'required&gt;&lt;br&gt;&lt;br&gt;
      Father Name:&lt;br&gt;
      &lt;input type="text" name='f_name'required&gt;&lt;br&gt;&lt;br&gt;
      Mother Name :&lt;br&gt;
      &lt;input type="text" name='m_name'required&gt;&lt;br&gt;&lt;br&gt;
      Address:&lt;br&gt;
      &lt;textarea rows="7" cols="31" name ='address' &gt;
      Please write your address here !
      &lt;/textarea&gt; &lt;br&gt;&lt;br&gt;
      Sex:&lt;br&gt;
      &lt;select name="sex"&gt;
      &lt;option value="male"&gt;Male&lt;/option&gt;
      &lt;option value="female"&gt;Female&lt;/option&gt;
      &lt;/select&gt;&lt;br&gt;&lt;br&gt;
      Position:&lt;br&gt;
      &lt;input type="text" name='position' required&gt;&lt;br&gt;&lt;br&gt;
      Subject:&lt;br&gt;
      &lt;input type="text" name='subject' required&gt;&lt;br&gt;&lt;br&gt;
      Sallary:&lt;br&gt;
      &lt;input type="text" name='salary' required&gt;&lt;br&gt;&lt;br&gt;
      Date:&lt;br&gt;
      &lt;br&gt;&lt;p&gt;&lt;input type="text" id="datepicker" name="dtime"&gt;&lt;/p&gt;&lt;br&gt;
      &lt;input type="hidden" name=  "formsubmitted" value="TRUE" /&gt;
  
      &lt;input type="submit" value='Submit'&gt;
  
  &lt;/form&gt;
  
  &lt;/body&gt;
  &lt;/html&gt;
  </code></pre>