title: Form calculation fails
body: <p>We're trying to fix the PHP code (from php programmer who was fired few weeks ago) to make sure these dates does not exceed more than 28 days on the form.</p>
  
  <p>When the customer fills out the application on the <a href="https://www.sorensonvrs.com/international_travel_request" rel="nofollow noreferrer">https://www.sorensonvrs.com/international_travel_request</a> and they fill it out over 28 days -  it fails.</p>
  
  <p><img src="https://www.sorensonvrs.com/assets/images/error-message.jpg" alt="Failed"></p>
  
  <p>PHP - </p>
  
  <pre><code>if ($valid_departure_date == TRUE &amp;&amp; $valid_return_date == TRUE) {
         $submit_date = intval(date("Ymd"));  // Today's date
         $departure_date_string = sprintf("%02d",$post['departureYear']).sprintf("%02d",$post['departureMonth']).sprintf("%02d",$post['departureDay']);
         $departure_date = intval($departure_date_string);
         $return_date_string = sprintf("%02d",$post['returnYear']).sprintf("%02d",$post['returnMonth']).sprintf("%02d",$post['returnDay']);
         $return_date = intval($return_date_string);
         if ($departure_date &gt; $return_date) {
           // $this-&gt;errors += array('depGTRet' =&gt; 'required');
           $this-&gt;errors = $post-&gt;errors();
           $post-&gt;add_error('depGTRet','required');
           $this-&gt;valid = '';
         } else {
           if ($submit_date &gt;= $departure_date) {
             // $this-&gt;errors += array('oldDates' =&gt; 'required');
             $post-&gt;add_error('oldDates','required');
             $this-&gt;errors = $post-&gt;errors();
             $this-&gt;valid = '';
           } else {
             $trip_departure_date = substr($departure_date,0,4) . '-' .  substr($departure_date,4,2) . '-' .  substr($departure_date,6,2);
             $trip_return_date = date_create($trip_departure_date);
             date_add($trip_return_date,date_interval_create_from_date_string("28 days"));
             $trip_return_date = intval(date_format($trip_return_date,"Ymd"));
             if ($return_date &gt;= $trip_return_date) {
               // $this-&gt;errors += array('checkDates' =&gt; 'required');
               $this-&gt;errors = $post-&gt;errors();
               $post-&gt;add_error('checkDates','required');
               $this-&gt;valid = '';
             } else {
               $validated_dates = TRUE;
             }
           }
         }
       }
  </code></pre>
  
  <p>We're not a math whiz, but these calculation in PHP is confusing us. Thank you!</p>