title: HTML form / PHP get input text LIVE
body: <p>I am using a HTML form for making a search field to my database via PHP. It works right now, when i enter text and press a button. But i want to make the results dynamic and show up as the user types. How do i get the textInput from the form live? without having to wait for the user to press a button and submit the text.</p>
  
  <p>The HTML text field:</p>
  
  <pre><code>&lt;form action="index.php" method="post"&gt;
  
      &lt;button class="fa fa-search button" name ="submit" type="submit"&gt;&lt;/button&gt;
      &lt;input class="search" type="text" name="input" placeholder="Søg"&gt;
  &lt;/form&gt;
  </code></pre>
  
  <p>The PHP script where i search the database and print the results:</p>
  
  <pre><code>&lt;?php
      $search = $_POST["input"];
      if (isset($_POST['submit'])) {
      echo "&lt;h2&gt; Søgeresultater &lt;/h2&gt;";
          $sql = "SELECT name, description, price, image, stock FROM products WHERE LOWER(name) LIKE '%" . $search . "%' OR LOWER(description) LIKE '%" . $search . "%'";
          $result = $conn-&gt;query($sql);
          while($row = $result-&gt;fetch_assoc()) {
              echo "&lt;br&gt;" . $row["name"]. ": " . $row["description"] ." - Price: " . $row["price"] . " DKK" . " Lagerstatus: ". $row["stock"] . "&lt;br&gt;";
              echo '&lt;img id="image"" src="data:image/jpeg;base64,'.base64_encode( $row['image'] ).'"/&gt;'; 
          }
      }
  ?&gt;
  </code></pre>