Ver Mensaje Individual
  #1 (permalink)  
Antiguo 24/07/2012, 08:00
Zota
 
Fecha de Ingreso: julio-2012
Mensajes: 51
Antigüedad: 12 años, 8 meses
Puntos: 0
Pasar consulta a ventana popup

Hola a todos.

Ando enredado, estoy haciendo una busqueda en la base de datos por medio de un formulario y quiero que cuando encuentre el resultado me lo muestre en una ventana popup, es decir:

Le pido al usuario que inserte el numero de guia a consultar en un campo de texto y cuando le de clic en buscar me abra una vantana popup mostrandome los campos de registros si es encontrado.

aqui les dejo el codigo, muchas gracias por su ayuda.


Código PHP:
<?php require_once('../../Connections/conex.php'); ?>
<?php
if (!function_exists("GetSQLValueString")) {
function 
GetSQLValueString($theValue$theType$theDefinedValue ""$theNotDefinedValue ""
{
  
$theValue get_magic_quotes_gpc() ? stripslashes($theValue) : $theValue;

  
$theValue function_exists("mysql_real_escape_string") ? mysql_real_escape_string($theValue) : mysql_escape_string($theValue);

  switch (
$theType) {
    case 
"text":
      
$theValue = ($theValue != "") ? "'" $theValue "'" "NULL";
      break;    
    case 
"long":
    case 
"int":
      
$theValue = ($theValue != "") ? intval($theValue) : "NULL";
      break;
    case 
"double":
      
$theValue = ($theValue != "") ? "'" doubleval($theValue) . "'" "NULL";
      break;
    case 
"date":
      
$theValue = ($theValue != "") ? "'" $theValue "'" "NULL";
      break;
    case 
"defined":
      
$theValue = ($theValue != "") ? $theDefinedValue $theNotDefinedValue;
      break;
  }
  return 
$theValue;
}
}

$colname_Recordset1 "-1";
if (isset(
$_GET['buscar'])) {
  
$colname_Recordset1 $_GET['buscar'];
}
mysql_select_db($database_conex$conex);
$query_Recordset1 sprintf("SELECT * FROM guia WHERE Numero = %s"GetSQLValueString($colname_Recordset1"text"));
$Recordset1 mysql_query($query_Recordset1$conex) or die(mysql_error());
$row_Recordset1 mysql_fetch_assoc($Recordset1);
$totalRows_Recordset1 mysql_num_rows($Recordset1);
?><!DOCTYPE html >

<html>
<head>
<title></title>
<meta charset="iso-8859-1" />
<link href="css/style.css" rel="stylesheet" type="text/css" />
<!--[if IE 6]>
        <link href="css/ie6.css" rel="stylesheet" type="text/css" />
    <![endif]-->
<!--[if IE 7]>
        <link href="css/ie7.css" rel="stylesheet" type="text/css" />  
    <![endif]-->
    
    
<link href="../../css/style.css" rel="stylesheet" type="text/css">
</head>

<body>
<div id="background">
  <div id="page">
    <div class="header">
      <div class="footer">
        <div class="body">
          <div id="sidebar">
            <ul class="navigation">
              <li><a  href="index.php">INICIO</a></li>
              <li class="active"><a href="Consultas.php" >CONSULTAS</a></li>
              <li><a href="Admin.php">ADMINISTRADOR</a></li>
              <li class="last"><a href="Usuarios.php">USUARIOS</a></li>
            </ul>
            <div class="connect"> <a href="#" class="facebook">&nbsp;</a> <a href="#" class="twitter">&nbsp;</a> <a href="#" class="vimeo">&nbsp;</a> </div>
            <div class="footenote"> <span>&copy; Copyright &copy; 2012.</span> <span><a href="index.html"></a> all rights reserved</span> </div>
          </div>
          <div id="content">
            <div class="content">
              <ul>
                <li>
                  <h2 align="center">DIGITE EL NUMERO DE GU&Iacute;A A CONSULTAR.</a> </h2>
                </li>
              </ul>
              <p>&nbsp;</p>
              <p align="center">
                <label></label>
</p>
              <form action="Resultado.php" method="post" name="formulario" id="formulario">
           
                <label>
                <div align="center">
                  <input name="buscar" type="text" id="buscar" size="10">
                </div>
                </label>
                <label>
                <div align="center">
                  <input type="submit" name="consulta" id="consulta" value="buscar">
                </div>
                </label>
                                                          
              </form>
              <p>&nbsp;</p>
            </div>
          </div>
        </div>
      </div>
    </div>
    <div class="shadow"> </div>
  </div>
</div>
</body>
</html>
<?php
mysql_free_result
($Recordset1);
?>