title: Having issues inserting jQuery datepicker into MySQL
body: <p>I have a survey form with a jQuery date picker but I am having issues getting the date inserted into the MySQL database. The result keeps coming up all zeros.</p>
  
  <p>My PHP and MySQL skills aren't great so a little help would be greatly appreciated. </p>
  
  <p>The date format in the database is datetime.</p>
  
  <p>My code is below.</p>
  
  <pre><code>&lt;input type="text" name="surveydate" id="datepicker"&gt;
  
  &lt;?php
  session_start(); // Session starts here.
  
  $servername = "";
  $username = "";
  $password = "";
  $dbname = "";
  
  $_SESSION['firstname'] = $_POST['firstname'];
  $_SESSION['lastname'] = $_POST['lastname'];
  $_SESSION['gender'] = $_POST['gender'];
  $_SESSION['postcode'] = $_POST['postcode'];
  $_SESSION['surveydate'] = $_POST['surveydate'];
  
  $firstname = $_SESSION['firstname'] ;
  $lastname = $_SESSION['lastname'];
  $gender = $_SESSION['gender'];
  $postcode = $_SESSION['postcode'];
  $surveydate= $_SESSION['surveydate'];
  
  // Create connection
  $conn = new mysqli($servername, $username, $password, $dbname);
  // Check connection
  if ($conn-&gt;connect_error) {
      die("Connection failed: " . $conn-&gt;connect_error);
  } 
  
  $sql = "INSERT INTO results (firstname,lastname,gender,postcode,surveydate)
  
  VALUES ('$firstname','$lastname','$gender','$postcode','$surveydate')";
  
  $today = date("d M Y");
  
  if ($conn-&gt;query($sql) === TRUE) {
  
  } else {
      echo "Error: " . $sql . "&lt;br&gt;" . $conn-&gt;error;
  }
  
  $conn-&gt;close();
  
  ?&gt;
  </code></pre>