title: PHP code not outputting what I need it to. How can I fix this?
body: <p>I posted the other day with errors that I needed help fixing and it seems that I have got them fixed but I ran into another issue. My code is made to take user inputs for an invoice and when they click submit I want it to output 'This Invoice is %y years, %m months, and %d days. I can't seem to get my code to work correctly and output this. I included both my index.php code and the data_tester.php code that I am using. </p>
  
  <pre><code>&lt;?php
  if (isset($_POST['action'])) {
  $action =  $_POST['action'];
  } else {
  $action =  'start_app';
  }
  
  switch ($action) {
  case 'start_app':
  
      // set default invoice date 1 month prior to current date
      $interval = new DateInterval('P1M');
      $default_date = new DateTime();
      $default_date-&gt;sub($interval);
      $invoice_date_s = $default_date-&gt;format('n/j/Y');
  
      // set default due date 2 months after current date
      $interval = new DateInterval('P2M');
      $default_date = new DateTime();
      $default_date-&gt;add($interval);
      $due_date_s = $default_date-&gt;format('n/j/Y');
  
      $message = 'Enter two dates and click on the Submit button.';
      break;
  case 'process_data':
      $invoice_date_s = filter_input(INPUT_POST,'invoice_date');
      $due_date_s = filter_input(INPUT_POST,'due_date');
  
      // make sure the user enters both dates
      if (empty($invoice_date_s) || empty($due_date_s)){
          $message = 'You must enter both dates. Please Try Again.';
          break;
      }
  
      // convert date strings to DateTime objects
      // and use a try/catch to make sure the dates are valid
  
      try{
          $invoice_date_o = new DateTime($invoice_date_s);
          $due_date_o = new DateTime($due_date_s);
      } catch (Exception $e){
          $message = 'Both dates must be in a valid format. Please check and try again';
          break;
      }
  
      // make sure the due date is after the invoice date
  
      if ($due_date_o &lt; $invoice_date_o){
          $message = 'The due date must come after the invoice date. Please check the information and try again.';
          break;
      }
      $format_string = 'F j, Y';
      // format both dates
      $invoice_date_f = $invoice_date_o-&gt;format($format_string);
      $due_date_f = $due_date_o-&gt;format($format_string);
  
  
      // get the current date and time and format it
      $current_date_o = new DateTime();
      $current_date_f = $current_date_o -&gt; format($format_string);
      $current_time_f = $current_date_o -&gt; format('g:i:s a');
  
      // get the amount of time between the current date and the due date
      $time_span = $current_date_o -&gt;diff($due_date_o);
      if ($due_date_o &lt; $current_date_o){
          $due_date_message = $time_span -&gt;format('This Invoice is %y years, %m months, and %d days.');
      }
  
      // and format the due date message
  
      break;
   }
   include 'date_tester.php';
   ?&gt;
  </code></pre>
  
  <p>Date_tester.php code</p>
  
  <pre><code>&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;title&gt;Date Tester&lt;/title&gt;
  &lt;link rel="stylesheet" type="text/css" href="main.css"/&gt;
  &lt;/head&gt;
  
  &lt;body&gt;
  &lt;div id="content"&gt;
      &lt;h1&gt;Date Tester&lt;/h1&gt;
      &lt;form action="." method="post"&gt;
      &lt;input type="hidden" name="action" value="process_data"/&gt;
  
      &lt;label&gt;Invoice Date:&lt;/label&gt;
      &lt;input type="text" name="invoice_date"
             value="&lt;?php echo htmlspecialchars($invoice_date_s); ?&gt;"/&gt;
      &lt;br /&gt;
  
      &lt;label&gt;Due Date:&lt;/label&gt;
      &lt;input type="text" name="due_date"
             value="&lt;?php echo htmlspecialchars($due_date_s); ?&gt;"/&gt;
      &lt;br /&gt;
  
      &lt;label&gt;&amp;nbsp;&lt;/label&gt;
      &lt;input type="submit" value="Submit" /&gt;
      &lt;br /&gt;
  
      &lt;/form&gt;
      &lt;h2&gt;Message:&lt;/h2&gt;
      &lt;?php if (!empty($message)): ?&gt;
  
          &lt;p&gt;&lt;?php echo $message; ?&gt;&lt;/p&gt;
      &lt;?php else : ?&gt;
      &lt;table cellspacing="5px"&gt;
          &lt;tr&gt;
              &lt;td&gt;Invoice date:&lt;/td&gt;
              &lt;td&gt;&lt;?php echo $invoice_date_f; ?&gt;&lt;/td&gt;
          &lt;/tr&gt;
          &lt;tr&gt;
              &lt;td&gt;Due date:&lt;/td&gt;
              &lt;td&gt;&lt;?php echo $due_date_f; ?&gt;&lt;/td&gt;
          &lt;/tr&gt;
          &lt;tr&gt;
              &lt;td&gt;Current date:&lt;/td&gt;
              &lt;td&gt;&lt;?php echo $current_date_f; ?&gt;&lt;/td&gt;
          &lt;/tr&gt;
          &lt;tr&gt;
              &lt;td&gt;Current time:&lt;/td&gt;
              &lt;td&gt;&lt;?php echo $current_time_f; ?&gt;&lt;/td&gt;
          &lt;/tr&gt;
          &lt;tr&gt;
              &lt;td&gt;Due date message:&lt;/td&gt;
              &lt;td&gt;&lt;?php echo $due_date_message = isset($due_date_message) ? $due_date_message : ""; ?&gt;&lt;/td&gt;
          &lt;/tr&gt;
      &lt;/table&gt;
      &lt;?php endif; ?&gt;
  
  &lt;/div&gt;
  &lt;/body&gt;
  &lt;/html&gt;
  </code></pre>
  
  <p>What needs to be done so when I click submit the output shows how long until the invoice is due.</p>