I have a table created in HTML with PHP and MySQL, and I need that with a input
to do a search in real time of that same table, will it be possible?
Here the code:
Body of the page:
<div id="main">
<div id="header">
<div id="headerText"><?php
if (isset($_GET['equipo'])){
echo $_GET['equipo'];
}elseif (isset($_GET['marca'])){
echo $_GET['marca'];
}
?>
</div>
</div>
<div id="content">
<input type="text" name="consulta" id="consulta" placeholder="Busque por codigo, nombre, presentacion, detalle">
<div id="resultado"></div>
<div id="contenido">
<table class="table-fill">
<thead>
<?php if(isset($_GET['equipo'])){
?>
<tr>
<th>Codigo</th>
<th>Descripcion</th>
<th>Marca</th>
<th>Presentacion</th>
<th>Detalle</th>
<th>Cantidad</th>
<th></th>
</tr>
</thead>
<tbody class="buscarTabla">
<?php
while($item = $consulta->fetch_assoc())
{
?>
<tr>
<form action="buscar.php" method="post">
<td><input type="hidden" name="codigo" id="codigo" value="<?php echo $item['codRef'];?>"><?php echo $item['codRef'];?></td>
<td><input type="hidden" name="descripcion" id="descripcion" value="<?php echo $item['descripcion'];?>"><?php echo $item['descripcion'];?></td>
<td><input type="hidden" name="marca" id="marca" value="<?php echo $item['marca'];?>"><?php echo $item['marca'];?></td>
<td><input type="hidden" name="present" id="present" value="<?php echo $item['present'];?>"><?php echo $item['present'];?></td>
<td><input type="hidden" name="detalle" id="detalle" value="<?php echo $item['detalle'];?>"><?php echo $item['detalle'];?></td>
<td><input type="text" name="cantidad" id="cantidad" placeholder="0"></td>
<td><button id="btnAgregar">Agregar</button></td>
</form>
</tr>
</tbody>
<?php
}
}elseif (isset($_GET['marca'])) {?>
<thead>
<tr>
<th>Codigo</th>
<th>Descripcion</th>
<th>Equipo</th>
<th>Presentacion</th>
<th>Detalle</th>
<th>Cantidad</th>
<th></th>
</tr>
</thead>
<tbody class="buscarTabla">
<?php
while($item = $consulta->fetch_assoc())
{
?>
<tr>
<form action="buscar.php" method="post">
<td><input type="hidden" name="codigo" id="codigo" value="<?php echo $item['codRef'];?>"><?php echo $item['codRef'];?></td>
<td><input type="hidden" name="descripcion" id="descripcion" value="<?php echo $item['descripcion'];?>"><?php echo $item['descripcion'];?></td>
<td><input type="hidden" name="equipo" id="equipo" value="<?php echo $item['equipo'];?>"><?php echo $item['equipo'];?></td>
<td><input type="hidden" name="present" id="present" value="<?php echo $item['present'];?>"><?php echo $item['present'];?></td>
<td><input type="hidden" name="detalle" id="detalle" value="<?php echo $item['detalle'];?>"><?php echo $item['detalle'];?></td>
<td><input type="text" name="cantidad" id="cantidad" placeholder="0"></td>
<td><button id="btnAgregar">Agregar</button></td>
</form>
</tr>
<?php
}
}
?>
</tbody>
</table>
</div>
</div>
</div>