title: How to use a $_POST variable in an mysqli-query? (php)
body: <p>I'm currently learning php and am testing around with sqli queries.
  I want to have an input field where a number can be entered. This number is used in the sql-query. Unfortunately it doesn't work the way I want.
  The text field is stored in index.php as this: </p>
  
  <pre><code>&lt;form method="post" action="handler.php"&gt;
  &lt;input type="text" name="idEingabe"&gt;
  &lt;input type="submit" value="Abfrage für eingegebene ID starten"&gt;
  &lt;/form&gt;
  </code></pre>
  
  <p>In handler.php, I'm using</p>
  
  <pre><code>$stridEingabe = $_POST["idEingabe"];
  </code></pre>
  
  <p>And the query contains:</p>
  
  <pre><code>$query = 'SELECT name, beschreibung FROM uebersicht WHERE id = "$stridEingabe"'; 
  $result = mysqli_query($con, $query);
  if ($result = mysqli_query($con, $query)) {
  /* Array ausgeben */
  while ($row = mysqli_fetch_assoc($result)) {
      printf ("&lt;b&gt;%s&lt;/b&gt; &lt;br&gt;%s&lt;br&gt; &lt;br&gt;", $row["name"],  $row["beschreibung"]);
  
  }
  
  /* free result set */
  mysqli_free_result($result);
  }
  mysqli_close($con);
  ?&gt;
  </code></pre>
  
  <p>Unfortunately I don't get any results when I enter the number into the text box and click the submit-button. But if I write the number in the query without using $stridEingabe, I'm getting the results.</p>
  
  <p>Where is the mistake?
  Thanks a lot</p>