Skip to content

Instantly share code, notes, and snippets.

@bran921007
Created August 4, 2014 00:05
Show Gist options
  • Save bran921007/4e37f96a29de7c86a048 to your computer and use it in GitHub Desktop.
Save bran921007/4e37f96a29de7c86a048 to your computer and use it in GitHub Desktop.
busqueda(mostrar) Danny
<?php
include 'plantilla.php';
?>
<h3 align="center">Rellena el campo para realizar tu busqueda</h3>
<form action="busqueda.php" method="get" id="cdr">
<table align="center">
<tr>
<td>Buscar:</td>
<td><input type="search" placeholder="Buscar" name="buscar" value="<?php if(isset($_GET['buscar'])){ echo $_GET['buscar']; } ?>" required ></td>
</tr>
<tr>
<td>&nbsp;</td>
</tr>
<tr>
<td align="center" colspan="2"><input type="submit" value="Buscar" class="btn btn-blue"></td>
</tr>
</table>
</form>
<div id="resultadoBusqueda">
<?php
//error_reporting(E_ERROR);
if(isset($_GET['buscar'])){
$buscar = $_GET['buscar'];
$bus = new buscador();
$rs = $bus->encontrar($buscar);
if(mysqli_num_rows($rs) < 1){
echo "<span style='color: red;'>No se entraron resultados de \"{$buscar}\"</span>";
echo "<br/>";
}else{
foreach($rs as $resul){
echo <<<CODIGO
<article class='articulos'>
<div class='imgArticulo'>
<img src='foto/foto.php?cod={$resul['id']}'>
</div>
<div class='infoArticulo'>
<strong>Nombre: </strong>{$resul['nombre']}<br/>
<strong>Sexo:</strong>{$resul['sexo']}<br/>
<strong>Raza:</strong>{$resul['raza']}<br/>
<strong>Tipo:</strong>{$resul['tipo']}<br/>
<strong>Tel. De Cont.:</strong>{$resul['telefono']} <br/>
<strong>Descripción: </strong>{$resul['descripcion']}<br/>
<a class="btn btn-blue" href='formularioAdopcion.php?adopt={$resul['id']}'>Adoptar</a>
</div>
</article>
CODIGO;
}
}
}
?>
</div>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment