title: I want the php results to be displayed on the same page instead of a completely new page
body: <p>I'm trying to search by name and display the results on the same page.
  My php code and the html code are in 2 separate files. Given below is my search.php code.</p>
  <pre><code>&lt;?php
  include_once '../connection.php';
  include_once '../session.php';
  $output = '';
      if(isset($_POST['search'])){
          $searchquery=$_POST['search'];
          
                              
  
  
  $result = mysqli_query($conn,&quot;SELECT * FROM details where customername LIKE '%$searchquery'&quot;);
  $count = mysqli_num_rows($result);
  if($count == 0) {
      $output = 'There was no search result!';
  }else{
      while($row = mysqli_fetch_array($result)) {
          $ID = $row['id'];
          $Name= $row['customername'];
          $Type = $row['type'];
          $Phone = $row['phoneno'];
          $Email = $row['email'];
          
          $output .= '&lt;div&gt;' .$Name.' '.$Type.' '.$Phone.' '.$Email.'&lt;div&gt;';
      }
  }
      
  
      }
  ?&gt;
  
  
  &lt;?php print(&quot;$output&quot;);?&gt;
  
  </code></pre>
  <p>Given below is the html code for my form.</p>
  <pre><code>&lt;form action=&quot;search.php&quot; method=&quot;POST&quot; &gt;
              &lt;center&gt;&lt;input type=&quot;text&quot;  name=&quot;search&quot; placeholder=&quot;Search by name&quot; &gt;
              &lt;input type=&quot;submit&quot;  value=&quot;Search&quot;&gt;&lt;/center&gt;
              &lt;br&gt;
              &lt;table id=&quot;myTable&quot;&gt;
                &lt;tr&gt;
                  &lt;th&gt;ID&lt;/th&gt;
                  &lt;th&gt;Name&lt;/th&gt;
                  &lt;th&gt;Type&lt;/th&gt;
                  &lt;th&gt;Telephone Number&lt;/th&gt;
                  &lt;th&gt;Email&lt;/th&gt;
                 
                  &lt;th&gt;Edit&lt;/th&gt;
                  &lt;th&gt;Delete&lt;/th&gt;
                &lt;/tr&gt;
                  &lt;?php
                      $i=0;
                      while($row = mysqli_fetch_array($result)) {
                  ?&gt;
                &lt;tr&gt;
                  &lt;td&gt;&lt;?php echo $row[&quot;id&quot;]; ?&gt;&lt;/td&gt;
                  &lt;td&gt;&lt;?php echo $row[&quot;customername&quot;]; ?&gt;&lt;/td&gt;
                  &lt;td&gt;&lt;?php echo $row[&quot;type&quot;]; ?&gt;&lt;/td&gt;
                  &lt;td&gt;&lt;?php echo $row[&quot;phoneno&quot;]; ?&gt;&lt;/td&gt;
                  &lt;td&gt;&lt;?php echo $row[&quot;email&quot;]; ?&gt;&lt;/td&gt;
  </code></pre>
  <p>When I search, the results are displayed on a completely new page. But  I want the results to be displayed on the same page with all the existing page layout, headers and footers.
  How can I achieve this?
  Thank in Advance!</p>