Ver Mensaje Individual
  #6 (permalink)  
Antiguo 02/10/2010, 08:16
Avatar de CazaresLuis
CazaresLuis
 
Fecha de Ingreso: septiembre-2010
Ubicación: Distrito Federal
Mensajes: 67
Antigüedad: 13 años, 7 meses
Puntos: 2
Sonrisa Respuesta: Colocar resultados de una busqueda MySQL con PHP a un div

Cita:
Iniciado por repara2 Ver Mensaje
Código PHP:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>Documento sin t&iacute;tulo</title>
</head>
<body>
<form action="<?=$_SERVER['PHP_SELF']?>" method="post" target="contenido">
  <div>
    <input type="text" name="buscar" />
    <input type="submit" value="Buscar" name="buscar" />
  </div>
</form>
<div id="contenido">
  <?php
if(isset($_POST['buscar'])){
    
//Código que ejecuta la select saca los resultados 
}
else{
echo 
"NO hay resultados";
}
?>
</div>
</body>
</html>
A ver si funciona, salu2
Hola hay dos formas de hacer, una recargando la misma página como lo proponen aqui y otra es que lo hagas con ajax de tal manera que la pagina no se recargue por cada busqueda que realizas, checate jquery y su funcion $.ajax()

Saludos

Última edición por GatorV; 04/10/2010 a las 16:00