Hola a todos, solucionado el problema que tenia, puedo pasar la consulta de una pagina php a otra, ahora lo que necesito es que al dar clic al boton de formulario me muestre la pagina de forma emergente, mas pequeña y lo otro es que si consulto y no hay registros me muestre un mensaje de "NO HAY REGISTROS".
dejo el codigo aqui, gracias.
pagina 1
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);
?><html>
<head><title>Mi Web</title></head>
<body>
<form action="destino.php" method="get" name="formulario" id="formulario">
<input type="text" name="buscar" id="buscar">
<br>
<label>
<input type="submit" name="button" id="button" value="buscar">
</label>
<p> </p>
<p>Resultado de consulta
</p>
<div id="listado">
<p>Su búsqueda de <i>'<?php echo $_GET['buscar']; ?>'</i> ha devuelto <?php echo $totalRows_busqueda ?> resultados: </p>
<p><?php echo $row_Recordset1['Remitente']; ?></p>
</div>
</form>
</body>
</html>
<?php
mysql_free_result($Recordset1);
?>
pagina dos.
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 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=utf-8" />
<title>Documento sin título</title>
</head>
<body>
<div id="listado">
<p>Su búsqueda de <i>'<?php echo $_GET['buscar']; ?>'</i> ha devuelto <?php echo $totalRows_busqueda ?> resultados: </p>
<p><?php echo $row_Recordset1['Remitente']; ?></p>
</div>
</body>
</html>
<?php
mysql_free_result($Recordset1);
?>