Q:

Basic search in PHP and MySQL

Why does not he show me any results from the database?  I use Mysqli. 
<h1>PC's</h1>
<form id="formPcs" method="POST">
  <input type="name" placeholder="Circutor_xxx">
  <input type="submit" value="Buscar" name="namehost">
</form>
<? php
  $connect = mysqli_connect("localhost","root","","circutor");

  if (@isset($_POST['namehost'])) {

    $viewquery = mysqli_query($connect, "SELECT * FROM hosts WHERE hostname='$_POST[namehost]'");
    if (mysqli_num_rows($viewquery) > 0) {
      while ($listar = mysqli_fetch_array($viewquery)) {
        ? >
          <h3><?php echo $listar['hostname']; ? ></h3>
        <? php
      }
    }else{

      echo "NO HAY RESULTADOS EN LA BBDD";
    }

  }else{
    $viewquery = mysqli_query($connect, "SELECT * FROM hosts ORDER BY id ASC");
    while ($listar = mysqli_fetch_array($viewquery)) {
      ? >
        <h3><?php echo $listar['hostname']; ? ></h3>
      <? php
    }
  }

 ? >

Este archivo es el que procesa la búsqueda, y no entiendo por qué salta directamente al else, también probado con LIKE de mysql y tampoco me working, necesito. 

A:

Your search input has to have a name attribute. 
Change:
<input type="name" placeholder="Circutor_xxx">

To:
<input type="name" name="q" placeholder="Circutor_xxx">

In your first SQL string, accordingly, replace:
$_POST[namehost]

With:
$_POST[q]

