title: Print table on same page with PHP,HTML and MySQL
body: <p><a href="https://i.stack.imgur.com/phvph.png" rel="nofollow noreferrer">I have an options form setup like this</a></p>
  
  <p>When I press the submit button, I expect to call a function which draws a table from a SQL query</p>
  
  <p><a href="https://i.stack.imgur.com/B8vTZ.png" rel="nofollow noreferrer">Table example here</a></p>
  
  <p>Trying to call said function like so:</p>
  
  <pre><code>&lt;?php
  $id = $_POST['id'];
  if($id &gt; 0) {
      $sql2="SELECT * FROM data WHERE Id = '$id';";
      $sql_res = mysqli_query($d,$sql2) or die("&lt;h1&gt;".mysqli_error()."&lt;/h1&gt;");
      tabula($sql_res);
  }
  ?&gt;
  </code></pre>
  
  <p>That results in an error - Undefined index: id</p>
  
  <p>on line </p>
  
  <pre><code>$id = $_POST['id'];
  </code></pre>
  
  <p>Please help :(</p>