title: Convert HTML with inline PHP to PDF
body: <p>Created a small application in which one can place orders for coffee, and orders along with the date they were ordered are saved into a database.</p>
  
  <p>I have a page, report.php, that generates reports based on date constraints from user input coming from an admin page, adminPage.html.</p>
  
  <p>adminPage.html passes the date constraints to report.php using GET function, and report.php generates a report using PHP with those constraints.</p>
  
  <p>I am having trouble converting the report page into a PDF. I tried using dompdf, however, it would not load the PHP report in the PDF, only the HTML code.</p>
  
  <p>Function where the user clicks the button to run the report on adminPage.html: </p>
  
  <pre><code>function runReport()
  {
  var jStartDate;
  var jEndDate;
  jStartDate = document.getElementById("reportStartDate").value;
  jEndDate = document.getElementById("reportEndDate").value;
  
  window.open("report.php?startDate="+jStartDate+"&amp;endDate="+jEndDate+"");
  
  }
  </code></pre>
  
  <p>The window.open opens the report page with the constraints loaded into the URL. I know it's not pretty, sorry :(</p>
  
  <p>Here is the report page I am trying to generate into a PDF. I was hoping to have a small button at the bottom of the screen that says "generate PDF" or something so when the user presses it, it thusly generates the PDF.</p>
  
  <pre><code>&lt;!DOCTYPE HTML&gt;
  &lt;script 
  src="https://ajax.googleapis.com/ajax/libs/jquery/1.12.2/jquery.min.js"&gt; 
  &lt;/script&gt;
  
  &lt;!-- allow login page to link to this when user is an admin --&gt;
  &lt;title&gt;Report&lt;/title&gt;
  
  &lt;link rel="stylesheet" type="text/css" href="styles.css"&gt;
  &lt;link rel="manifest" href="/manifest.json"&gt;
  
  &lt;center&gt;&lt;img src="icons/sbuxLogo.png" width="100" height="100px"&gt;&lt;/center&gt;
  &lt;/br&gt;&lt;/br&gt;
  &lt;center&gt;&lt;h1&gt;Welcome Administrator!&lt;/h1&gt;&lt;/center&gt;
  &lt;/br&gt;&lt;/br&gt;
  &lt;center&gt;
  
  &lt;div id="report"&gt;
  
  &lt;h2&gt;Report:&lt;/h2&gt;
  &lt;/br&gt;
  &lt;/center&gt;
  
  &lt;?php
  require "phpScripts/connect.php";
  
  $startDate = $_GET['startDate'];
  $endDate = $_GET['endDate'];
  
  $sql = "SELECT * FROM orderlist WHERE NOT (dateOrdered &lt; '$startDate' OR dateOrdered &gt; '$endDate');";
  
  $result = $conn-&gt;query($sql);
  
  echo "&lt;center&gt;";
  echo "&lt;ul&gt;";
  if($result-&gt;num_rows &gt;0)
  {
    $i = 0;
    while($row = $result-&gt;fetch_assoc()) // this loads selected drinks via date 
  into ul
    {
      echo  "&lt;li style=
      'margin-left: 0;
      list-style-type: none;
      color: #727272;
      height: 40px;
      font-size: 15px;
      font-family: Open Sans;
      border-style: none;
      width: 50%;
      list-style-type: none;
      margin:0;
      padding-bottom:0px;
      padding:0;
      overflow: hidden;'&gt;
  
      Drink: ".$row["drinkName"]. ", Date Ordered: " .$row["dateOrdered"] . ", 
  Cost: " .$row["drinkCost"] . "&lt;/li&gt;";
    $i = $i+1;
    }
  }else {
    echo "&lt;p&gt; No orders found. &lt;/p&gt;";
  }
  echo "&lt;/ul&gt;";
  echo "&lt;/center&gt;";
  ?&gt;
  
  &lt;/div&gt;
  </code></pre>