title: Getting date with jQuery and saving it to MySQL with a PHP form
body: <p>I need a small example on sending date to mysql db from a php form. Tried lots of examples but I seems I am missing o step.
  I have prepared a form for 3 fields, name last name and birth date. When I fill the form and submit date filed gets crazy :) 0000-00-00 00:00:00</p>
  
  <p>I tried to format the date but this time I could not understand how to pass it to mysql. Here is my funny code;</p>
  
  <pre><code>&lt;?php include "header.php" ?&gt;
  &lt;?php include "conn.php" ?&gt;
  &lt;script&gt;
      $(function() {
          $( "#bdate" ).datepicker();
      });
  &lt;/script&gt;
  &lt;?php
      if(isset($_POST['submit'])){
          $PlayerName = $_POST['PlayerName'];
          $PlayerLname = $_POST['PlayerLname'];
          $PlayerBdate = $_POST['PlayerBdate'];
          $query = "INSERT INTO tblPlayer (
                  PlayerName, PlayerLname, PlayerBdate
      ) VALUES (
          '{$PlayerName}', '{$PlayerLname}', '{$PlayerBdate}'
      )";
          if(mysql_query($query,$connection)){
              //Sucess
              header("Location: players_list.php");
          } else{
              echo "&lt;p&gt;something is wrong&lt;/p&gt;";
              echo "&lt;p&gt;" . mysql_error() . "&lt;/p&gt;";
          }
  
      }
  ?&gt;
  &lt;form action="add_player.php" method="post"&gt;
  &lt;table&gt;
  &lt;tr&gt;
     &lt;td&gt;Name: &lt;/td&gt;
     &lt;td&gt;&lt;input type="text" name="PlayerName" /&gt;&lt;/td&gt;
     &lt;/tr&gt;
     &lt;tr&gt;
     &lt;td&gt;Lastname:&lt;/td&gt;
     &lt;td&gt;&lt;input type="text" name="PlayerLastName" /&gt;&lt;/td&gt;
     &lt;/tr&gt;
     &lt;tr&gt;
     &lt;td&gt;Birthdate:&lt;/td&gt;
     &lt;td&gt;&lt;input id="bdate" type="text" name="PlayerBdate" /&gt;&lt;/td&gt;
     &lt;/tr&gt;
     &lt;tr&gt;
     &lt;td&gt;&lt;input type="submit" name="submit" value="Save" /&gt;&lt;/td&gt;
     &lt;td align="right"&gt;&amp;nbsp;&lt;/td&gt;
     &lt;/tr&gt;
     &lt;/table&gt;
  &lt;?php ob_end_flush() ?&gt;
  &lt;?php include ("footer.php") ?&gt;
  </code></pre>
  
  <p>header.php contains</p>
  
  <pre><code>&lt;?php ob_start(); ?&gt;
  &lt;!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"&gt;
  &lt;html xmlns="http://www.w3.org/1999/xhtml"&gt;
  &lt;head&gt;
  &lt;meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /&gt;
      &lt;link rel="stylesheet" href="http://code.jquery.com/ui/1.10.2/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.2/jquery-ui.js"&gt;&lt;/script&gt;
  &lt;title&gt;Untitled Document&lt;/title&gt;
  &lt;/head&gt;
  &lt;body&gt;
  </code></pre>
  
  <p>and conn.php is the standard connection sting file.Footer.php is just closing the connection:)
  Also I could not make my code work without the ob_start(); and end functions:S</p>
  
  <p>So can you point out how can I get the date as day/month/year format and save it to mysql that way?</p>