title: Sending Database dropdown & jQuery DatePicker data to a mySQL Database
body: <p>I have encountered a problem recently and I am unable to solve it. I have a client booking form, where they get a dropdown menu which is connected to a database with treatments etc. that displays all the data, and I also have a jQuery DatePicker, and further plans to implement a jQuery TimePicker very soon. </p>
  
  <p>When I try to submit the form to be updated to a mySQL Database, none of the data comes through. It doesn't even show up as an array whey I <code>var_dump($_POST)</code> the whole thing. Also I have a textarea, it says the data goes through, but it doesn't actually appear in the database.</p>
  
  <p>Here is the <code>var_dump($_POST)</code>:</p>
  
  <p><a href="https://i.stack.imgur.com/j5Hov.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/j5Hov.png" alt="enter image description here"></a></p>
  
  <p>Here is the database dropdown <strong>PHP</strong> code:</p>
  
  <pre><code>&lt;!-- All database connection stuff followed by the following: --&gt;
  
  $query = "SELECT * FROM `Treatments`";
  
  $result = mysql_query($query, $con);
  $options = "";
  
  if (!$result){
      die("No results found.");
  }
  
  while ($row = mysql_fetch_array($result)){
      $options .= "&lt;option&gt;$row[1]&lt;/option&gt;";
  }
  
  
  ?&gt;
  </code></pre>
  
  <p>And here is what gets inserted into my Database:<br>
  - I have the DataTypes in mySQL set as <code>DATE</code> for Date and <code>TIME</code> for Time - </p>
  
  <p><a href="https://i.stack.imgur.com/9WvIu.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/9WvIu.png" alt="enter image description here"></a></p>
  
  <p>Here is my <strong>PHP</strong>:</p>
  
  <pre><code>&lt;?php
  var_dump($_POST);
  
  $hostname = 'hostname';
  $dbname = 'dbname';
  $username = 'username';
  $password = 'password';
  
  $con=mysql_connect($hostname,$username,$password) or die("Failed to connect to MySQL: " . mysql_error());
  $db=mysql_select_db($dbname,$con) or die("Failed to connect to MySQL: " . mysql_error());
  
  $insert = "INSERT INTO Booking_request_form (Treatment, Date, Time, Message) VALUES('".$_POST["Treatment"]."','".$_POST["Date"]."', '".$_POST["Time"]."', '".$_POST["Message"]."')";
  
  var_dump($insert);
  $handle = mysql_query($insert);
  var_dump($handle);
  
  ?&gt;
  </code></pre>
  
  <p>And here is my <strong>HTML</strong> form: <br> 
  I have commented out the TimePicker because it didn't work for me.</p>
  
  <pre><code>&lt;form action="treatment_form.php" method="post"&gt; 
      &lt;div class="heading1"&gt;
          &lt;p&gt;Select Your Treatment:&lt;/p&gt;
      &lt;/div&gt;
  
      &lt;div class="dropdown"&gt;
          &lt;select&gt;&lt;?php echo $options; ?&gt;&lt;/select&gt;
      &lt;/div&gt;
  
      &lt;div class="heading2"&gt;
          &lt;p&gt;Select Your Date:&lt;/p&gt;
              &lt;input type="text" id="datepicker"/&gt;
                  &lt;script&gt;
                  $(function() {
                      $( "#datepicker" ).datepicker({dateFormat: 'dd/mm/yy'});
                  });
                  &lt;/script&gt;
      &lt;/div&gt;
  
      &lt;div class="heading3"&gt;
          &lt;p&gt;Select Your Time:&lt;/p&gt;
              &lt;input type="text" id="timepicker"/&gt;
              &lt;!-- &lt;script&gt;
              $(function($) {
                  $(function() {
                      $('input.timepicker').timepicker();
                  });
              })(jQuery);
              &lt;/script&gt; --&gt;
      &lt;/div&gt;
  
      &lt;div class="heading4"&gt;
          &lt;p&gt;Add a message for our Staff:&lt;/p&gt;
          &lt;textarea name="message" placeholder="Enter Message..."&gt;&lt;/textarea&gt;
      &lt;/div&gt;
  
      &lt;div class="submit"&gt;
          &lt;input type="submit" value="Request Booking" id="Submit"&gt;
      &lt;/div&gt;
  &lt;/form&gt;
  </code></pre>