title: PHP date input format
body: <p>Created a PHP input form to <code>POST</code> dates into SQL query, on the server side we have <code>0000-00-00</code> date format but locally we use the <code>00/00/0000</code> format, how do get the input form to accept the <code>00/00/0000</code> format to be used in the SQL query? By now we force the users to put the <code>0000-00-00</code> and it works perfectly but a lot of them are complaining about that!</p>
  
  <pre><code>&lt;form action="index.php" method="POST"&gt;
  &lt;cust&gt;From: &lt;/cust&gt;&lt;input name="start_date" placeholder=" 0000-00-00" /&gt;
  &lt;cust&gt;Until: &lt;/cust&gt;&lt;input name="end_date" placeholder=" 0000-00-00" /&gt;
  &lt;select name="RegioSelect" placeholder="Choose"&gt;&lt;option&gt;&lt;/option&gt;
  &lt;?php
  
  $region = $_POST["RegioSelect"];
  $fdate = $_POST["start_date"];
  $edate = $_POST["end_date"];
  
  if(empty($fdate)){
      $fdate = '2000-01-01';  
      } else {
      $fdate;
      }
  if(empty($edate)){
      $edate = date("Y/m/d");
      } else {
      $edate;
      }
  </code></pre>
  
  <p>We were thinking convert on server side but in that case we can't use dates to compare date ranges. We convert them after retrieving to user's info as follows:</p>
  
  <pre><code>$new_fdate = strtotime($fdate);
  $FiDate = date('d/m/Y',$new_fdate);
  
  changed '$edate' to date("Y-m-d");
  $new_edate = strtotime($edate);
  $EnDate = date('d/m/Y',$new_edate);
  ?&gt;
  &lt;input type="submit" value="Select region"&gt;
  &lt;/select&gt;&lt;/br&gt;
  &lt;/form&gt;
  
  &lt;?php
  
  if(empty($region)){
      $region = ' ';
  } else {?&gt;&lt;h4&gt;&lt;?php echo $region; ?&gt;&lt;/h4&gt;&lt;cust&gt;&lt;b&gt;From:&lt;/b&gt;&lt;?php echo $FiDate; ?&gt; &lt;b&gt;Until:&lt;/b&gt; &lt;?php echo $EnDate; ?&gt;&lt;/cust&gt;
  &lt;?php
  }
  ?&gt;
  </code></pre>