title: Validate form so End Date can not be before Start Date. - PHP
body: <p>I have this part of a form where it shows end start and end date. I have validated it so that if no date is entered then an error message will show asking the use to enter a date, however, I need it to also check that the end date is not before the start date and echo an error asking the user to make sure the end date is after the start date if this happens. It's probably something very simple but I just can't figure out the correct code. Thanks.</p>
  
  <pre><code>// event start date
  echo "&lt;li class='cf'&gt;";
  echo "&lt;label for='startdate'&gt;Start date&lt;/label&gt;";
  echo "&lt;div class='input'&gt;";
  echo "&lt;input name='startdate' class='eventdate' placeholder='DD/MM/YYYY' type='date' value='";
  if (!is_null($postedData['startdate'])) { echo $postedData['startdate']; };
  echo "' /&gt;";
  if($failedData['startdate']) { echo "&lt;p class='error'&gt;Please enter the date of your event.&lt;/p&gt;";    }   
  echo "&lt;/div&gt;";
  echo "&lt;/li&gt;";
  
  echo $postedData['startdate'];
  
  // event end date
  echo "&lt;li class='cf'&gt;";
  echo "&lt;label for='enddate'&gt;End date&lt;/label&gt;";
  echo "&lt;div class='input'&gt;";
  echo "&lt;input name='enddate' class='eventdate' placeholder='DD/MM/YYYY' type='date' value='";
  if (!is_null($postedData['date'])) { echo $postedData['date']; };
  echo "' /&gt;";
  if($failedData['enddate']) { echo "&lt;p class='error'&gt;Please enter the date of your event.&lt;/p&gt;"; }    
  
  echo "&lt;/div&gt;";
  echo "&lt;/li&gt;";
  
  echo $postedData['enddate'];
  
  echo "&lt;li class='cf'&gt;";
  echo "&lt;label for='timestart'&gt;Event time&lt;/label&gt;";
  echo "&lt;div class='input inputs'&gt;";
  </code></pre>