title: Show Additional Form Data when Result is Isolated
body: <p>I have a form that displays the results from a survey into a webpage. At the moment, when a user clicks on the 'View Here' it takes them to the individual entry for that ID. When it is clicked I would like it to also show additional results (also part of the results from the same database).</p>
  
  <p>Any idea how I do this? Just to clarify, it should not show until the ID is clicked to single out that entry - otherwise it shows them all in full one after the other.</p>
  
  <pre><code>&lt;?php
  
  try {
      $handler = new PDO('mysql:host=localhost;dbname=***', '***', '***');
      $handler-&gt;setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
  } catch(PDOException $e) {
      echo $e-&gt;getMessage();
      die();
    }
  class guestquestionnaireEntry {
      public $id, $date_submitted, 
          $entry;
  
          public function __construct()
      {
  
  $this-&gt;entry = "
  
          &lt;table border='1' align='center'&gt;
  
                   &lt;tr class='tablelist' style='font-size: 8pt;' &gt;&lt;td width='5%' colspan='2'&gt;{$this-&gt;ID}&lt;/td&gt;&lt;td width='40%' colspan='2'&gt;&lt;b&gt;Date Received: &lt;/b&gt;{$this-&gt;date_submitted}&lt;/td&gt;&lt;td width='45%' colspan='2'&gt;{$this-&gt;name}&lt;/td&gt;&lt;td width='10%'&gt;&lt;a href=\"?ID={$this-&gt;ID}\"&gt;View here&lt;/a&gt; &lt;/td&gt;&lt;/tr&gt;
  
          &lt;/table&gt;
  
  ";
  
      }
  
  }
  
          SELECT DATE_FORMAT(date_submitted, '%m/%d/%Y') AS date_submitted FROM guestquestionnaire
  
  
  // Checks if the submitted is a number. If so, isolates the ID and adds "where" clause
  $id      =   (!empty($_GET['ID']) &amp;&amp; is_numeric($_GET['ID']))? " where ID = '".$_GET['ID']."'" : "";
  // Add the $id to the end of the string
  // A single call would be SELECT * FROM guestquestionnaire where ID = '1'
  $query   =   $handler-&gt;query("SELECT * FROM guestquestionnaire{$id}");
  $query-&gt;setFetchMode(PDO::FETCH_CLASS, 'guestquestionnaireEntry');
  
  while($r = $query-&gt;fetch()) {
      echo $r-&gt;entry, '&lt;br&gt;';
  }
  
  ?&gt;
  </code></pre>
  
  <p>Additional code that I would like to show once 'View Here' is clicked (so when the individual entry is shown):</p>
  
  <pre><code>class guestquestionnaireEntry {
      public $id, $date_submitted, $choice, $expectations, $res, $res_information, $res_staff, $further_comments1,
          $entry;
  
  public function __construct()
      {
  
  $this-&gt;entry = "
           &lt;tr style='font-size: 8pt;'&gt;&lt;td width='60%'&gt;&lt;a href=\"?ID={$this-&gt;ID}\"&gt;ID&lt;/a&gt; &lt;/td&gt;&lt;td width='40%' colspan='2'&gt;{$this-&gt;date_submitted}&lt;/td&gt;&lt;/tr&gt;
  
          &lt;tr style='text-align: left; font:arial;'&gt;&lt;td&gt;&lt;h3&gt;Date Submitted: {$this-&gt;date_submitted}&lt;/h3&gt;&lt;/td&gt;&lt;/tr&gt;
  
  
          &lt;table border='1' align='center'&gt;
  
          &lt;tr style='background: #566890; font-size: 8pt; font-weight: bold; color: #fff;'&gt;&lt;td colspan='3'&gt;Prior to Arrival&lt;/td&gt;&lt;/tr&gt;
  
  
              &lt;tr style='font-size: 8pt;'&gt;&lt;td width='60%'&gt;What made you choose us for your recent trip? &lt;/td&gt;&lt;td width='40%' colspan='2'&gt;{$this-&gt;choice}&lt;/td&gt;&lt;/tr&gt;
  
              &lt;tr style='font-size: 8pt;'&gt;&lt;td&gt;Did we meet your expectations as advertised? If no, please state why: &lt;/td&gt;&lt;td width='40%' colspan='2'&gt;{$this-&gt;expectations}&lt;/td&gt;&lt;/tr&gt;
  
  
          &lt;tr style='background: #566890; font-size: 8pt; font-weight: bold; color: #fff;'&gt;&lt;td colspan='3'&gt;Making your Reservation&lt;/td&gt;&lt;/tr&gt;&lt;BR&gt;
  
  
          &lt;tr style='font-size: 8pt;'&gt;&lt;td&gt;Ease of making your reservation: &lt;/td&gt;&lt;td width='40%'&gt;$img&lt;/td&gt;&lt;td width='5%'&gt;{$this-&gt;res}&lt;/td&gt;&lt;/tr&gt;&lt;BR&gt;
  
          &lt;tr style='font-size: 8pt;'&gt;&lt;td&gt;Hotel information offered: &lt;/td&gt;&lt;td width='40%'&gt;$img2&lt;/td&gt;&lt;td width='5%'&gt;{$this-&gt;res_information}&lt;/td&gt;&lt;/tr&gt;&lt;BR&gt;
  
          &lt;tr style='font-size: 8pt;'&gt;&lt;td&gt;Warmth and friendliness of staff: &lt;/td&gt;&lt;td width='40%'&gt;$img3&lt;/td&gt;&lt;td width='5%'&gt;{$this-&gt;res_staff}&lt;/td&gt;&lt;/tr&gt;&lt;BR&gt;
  
          &lt;tr style='font-size: 8pt;'&gt;&lt;td colspan='3'&gt;Further Comments: &lt;/BR&gt;&lt;/BR&gt;{$this-&gt;further_comments1}&lt;/td&gt;&lt;/tr&gt;
  
          &lt;BR&gt;
  
          &lt;/table&gt;
  
          &lt;BR&gt;
          &lt;p&gt;Back to List&lt;/p&gt;
  
  ";
  </code></pre>