Ver Mensaje Individual
  #4 (permalink)  
Antiguo 01/01/2012, 05:00
jmabreu
 
Fecha de Ingreso: julio-2010
Mensajes: 197
Antigüedad: 13 años, 9 meses
Puntos: 32
Respuesta: codigo php para buscador interno de web

formulario que busca resultados


<form id="form2" name="form2" method="post" action="search.php">
<div align="right" class="style1">
<div align="center">Buscar imagenes:
<input name="txtBuscar" type="text" id="txtBuscar" value="<?php echo $_POST['txtBuscar']; ?>" size="38" />
</div>
</div>
<div align="center">
<input name="enviar" src="img_btn/search.png" type="image" />
</div>
</form>





ejecuta la consulta

<?php
$Texto = $_POST['txtBuscar'];
if(isset($_POST['txtBuscar'])){$tabla = mysql_query("SELECT * FROM Archivos WHERE Nombre LIKE '%$Texto%'"); $Total = mysql_num_rows($tabla);}else{}
?>





listado de resutados

<?php if(isset($_POST['txtBuscar'])){
if($Total==0){echo 'No se ha encontrado resultados';}else{echo $Total; echo ' Resultados encontrados'; } }else {echo 'Inserte los datos para realizar su busqueda';}?>
<?php if($Total<>0) { while ($reg = mysql_fetch_array($tabla)) { ?>

<br />
<br />
<table width="900" border="0" align="center">
<tr>
<td width="177" class="style1">Nombre Imagen: <br />
<span class="style5"><?php echo $reg['Nombre']; ?></span></td>
<td width="206" class="style1">Subido por: <br />
<span class="style5"><?php echo $reg['Usuario']; ?></span></td>
<td rowspan="2" class="style1"><form id="form3" name="form3" method="post" action="function/logo-seal.php">
<div align="center">
<input name="archivoL" type="hidden" id="archivoL" value="<?php echo $reg['Archivo']; ?>" />
<input name="enviar3" type="image" onclick="javascript: if(!confirm('¿Está seguro que desea usar esta imagen como logo?')) return false" src="img_btn/acept.png" />
<br />
Usar Como logo </div>
</form> </td>
</tr>
<tr>
<td>Fecha: <br />
<span class="style5"><?php echo $reg['Fecha']; ?></span></td>
<td>Archivo: <br />
<span class="style5"><?php echo $reg['Archivo']; ?></span></td>
</tr>
</table>
<?php } } else {}?>