title: HTML Form to PHP how to return a value instead of displaying the file?
body: <p>I've made a HTML file containing only a form with a textbox and a submit button.</p>
  
  <p>The form calls a php that will check if the text from the textbox represents a register in the database.</p>
  
  <p>Html file:</p>
  
  <pre><code>&lt;form action="index.php" method="post"&gt;
  &lt;input type="text" name="nome"/&gt;
  &lt;input type="submit" value="Rodar"/&gt;
  &lt;/form&gt;
  </code></pre>
  
  <p>PHP file:</p>
  
  <pre><code>&lt;?php
  
  $nome = $_POST['nome'];
  $pdo = new PDO('mysql:host=myhost;dbname=mydb', 'user', 'pw');
  
  if ($pdo-&gt;query("SELECT * from renatinho where nome='".$nome."'")-&gt;fetchColumn() &gt; 0){
      foreach($pdo-&gt;query("SELECT * from renatinho where nome='".$nome."'") as $row) {
          echo $row['id'] . $row['nome'];
      }
      $pdo = null;
  }
  else{
      echo "Não há ninguém com esse nome.";
  }
  ?&gt;
  </code></pre>
  
  <p>The thing is: when I press the button it calls and displays the php file. The php file has no layout. I want the results to be displayed in the HTML file, cause i don't want to make a whole new page just to display the values.</p>
  
  <p>I want the results to be in the same page where the form is.</p>
  
  <p>I've being googling it for 2 days, but I don't know what exactly to search. All the results I got are tutorials that displays the php file, and that's what I'm doing now but that's not what I want.</p>