Claro aca voy a poner el codigo completo de la pagina, soy nuevo en esto entonces no se como llamar la consulta cuando doy click a "buscar", puse 2 forms una que contiene los campos de busqueda y la otra que muestra los resultados.
Muchas gracias de antemano
Código PHP :
<?php require_once('../Connections/servidorenvivo.php'); ?>
<?php
if (!function_exists("GetSQLValueString")) {
function GetSQLValueString($theValue, $theType, $theDefinedValue = "", $theNotDefinedValue = "")
{
if (PHP_VERSION < 6) {
$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;
}
}
mysql_select_db($database_servidorenvivo, $servidorenvivo);
$query_busqueda = "SELECT clientes.CLIENTE, clientes.NOMBRE, clientes.AGENTE, clientes.ZONA, clientes.CANAL FROM clientes WHERE CLIENTE = '".$_POST['cliente']."' OR NOMBRE LIKE '".$_POST['nombre']."' OR AGENTE LIKE '".$_POST['agente']."'";
$busqueda = mysql_query($query_busqueda, $servidorenvivo) or die(mysql_error());
$row_busqueda = mysql_fetch_assoc($busqueda);
$totalRows_busqueda = mysql_num_rows($busqueda);
?>
<!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"><!-- InstanceBegin template="/Templates/general.dwt.php" codeOutsideHTMLIsLocked="false" -->
<head>
<!-- InstanceBeginEditable name="doctitle" -->
<title>Rutas La Nacional</title>
<!-- InstanceEndEditable -->
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<link href="../css/style.css" rel="stylesheet" type="text/css" />
<link rel="stylesheet" type="text/css" href="../css/coin-slider.css" />
<script type="text/javascript" src="../js/cufon-yui.js"></script>
<script type="text/javascript" src="../js/cufon-titillium-250.js"></script>
<script type="text/javascript" src="../js/jquery-1.4.2.min.js"></script>
<script type="text/javascript" src="../js/script.js"></script>
<script type="text/javascript" src="../js/coin-slider.min.js"></script>
<script src="../Scripts/swfobject_modified.js" type="text/javascript"></script>
<!-- InstanceBeginEditable name="head" -->
<style type="text/css">
#tablabuscar {
color: #00F;
text-align: center;
}
#resultados {
color: #00F;
text-align: center;
}
#contenidobusqueda {
text-align: center;
}
</style>
<!-- InstanceEndEditable -->
<style type="text/css">
#Foot {
text-align: center;
}
</style>
</head>
<body>
<div class="main">
<div class="header">
<div class="header_resize">
<div class="logo">
<h1><a href="../index.php"><span>rutas</span> <small>Aplicacion de rutas</small></a></h1>
</div>
<div class="menu_nav">
<ul>
<li class="active"><a href="../index.php"><span>inicio</span></a></li>
<li><a href="#"><span>sala de juntas</span></a></li>
<li><a href="#"><span>Clientes</span></a></li>
<li><a href="#"><span>bodega</span></a></li>
<li><a href="#"><span>vendedores</span></a></li>
</ul>
</div>
<div class="clr">
<object id="FlashID2" classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" width="960" height="40">
<param name="movie" value="../preview2.swf" />
<param name="quality" value="high" />
<param name="wmode" value="opaque" />
<param name="swfversion" value="8.0.35.0" />
<!-- This param tag prompts users with Flash Player 6.0 r65 and higher to download the latest version of Flash Player. Delete it if you don’t want users to see the prompt. -->
<param name="expressinstall" value="../Scripts/expressInstall.swf" />
<!-- Next object tag is for non-IE browsers. So hide it from IE using IECC. -->
<!--[if !IE]>-->
<object type="application/x-shockwave-flash" data="../preview2.swf" width="960" height="40">
<!--<![endif]-->
<param name="quality" value="high" />
<param name="wmode" value="opaque" />
<param name="swfversion" value="8.0.35.0" />
<param name="expressinstall" value="../Scripts/expressInstall.swf" />
<!-- The browser displays the following alternative content for users with Flash Player 6.0 and older. -->
<div>
<h4>Content on this page requires a newer version of Adobe Flash Player.</h4>
<p><a href="http://www.adobe.com/go/getflashplayer"><img src="http://www.adobe.com/images/shared/download_buttons/get_flash_player.gif" alt="Get Adobe Flash player" width="112" height="33" /></a></p>
</div>
<!--[if !IE]>-->
</object>
<!--<![endif]-->
</object>
</div>
<div class="clr"></div>
</div>
</div>
<div class="content">
<div class="content_resize">
<div class="mainbar"><!-- InstanceBeginEditable name="Centro" -->
<div class="article">
<h2>Busqueda de Clientes.</h2>
<p>Buscar por los siguientes criterios.</p>
<form id="form1" name="form1" method="post" action="">
<p>
<label for="cliente">Numero Cliente:</label>
<input type="text" name="cliente" id="cliente" />
<label for="nombre"><br />
Nombre Cliente:</label>
<input type="text" name="nombre" id="nombre" />
<label for="agente"><br />
Nombre Agente:</label>
<input type="text" name="agente" id="agente" />
<label for="zona"><br />
</label>
</p>
<p>
<input type="submit" name="buscar" id="buscar" value="Buscar" />
</p>
</form>
<h2>Resultados de la busqueda.</h2>
<form id="form2" name="form2" method="post" action="">
<table width="645" border="1" align="center" cellpadding="0" cellspacing="0">
<tr id="resultados">
<td width="100">Numero Cliente</td>
<td width="208">Nombre Cliente</td>
<td width="80">Agente</td>
<td width="90">Zona</td>
<td width="90">Canal</td>
</tr>
<?php do { ?>
<tr id="contenidobusqueda">
<td><?php echo $row_busqueda['CLIENTE']; ?></td>
<td><a href="info.php?id=<?php echo $row_busqueda['CLIENTE']; ?>"><?php echo $row_busqueda['NOMBRE']; ?></a></td>
<td><?php echo $row_busqueda['AGENTE']; ?></td>
<td><?php echo $row_busqueda['ZONA']; ?></td>
<td><?php echo $row_busqueda['CANAL']; ?></td>
</tr>
<?php } while ($row_busqueda = mysql_fetch_assoc($busqueda)); ?>
</table>
<p> </p>
<p> </p>
</form>
<p> </p>
<p> </p>
<div class="clr"></div>
<div class="img"></div>
<div class="clr"></div>
</div>
<!-- InstanceEndEditable --></div>
<!-- InstanceBeginEditable name="Lateral" -->
<div class="sidebar">
<div class="gadget">
<h2 class="star">Menu</h2>
<div class="clr"></div>
<ul class="sb_menu">
<li><a href="../index.php">Inicio</a></li>
<li><a href="ingresar.php">Ingresar Cliente</a></li>
<li><a href="#">Editar Cliente</a></li>
<li><a href="#">Eliminar Cliente</a></li>
<li></li>
</ul>
</div>
<div class="gadget">
<div class="clr"></div>
<ul class="ex_menu">
<li></li>
</ul>
<p> </p>
<p><img src="../images/lanaional.jpg" width="234" height="43" /></p>
<img src="../images/img1.jpg" alt="" width="200" height="210" /></div>
</div>
<!-- InstanceEndEditable -->
<div class="clr"></div>
</div>
</div>
<div class="footer">
<div class="footer_resize">
<div style="clear:both;">
<object id="FlashID" classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" width="960" height="33">
<param name="movie" value="../preview.swf" />
<param name="quality" value="high" />
<param name="wmode" value="opaque" />
<param name="swfversion" value="9.0.45.0" />
<!-- This param tag prompts users with Flash Player 6.0 r65 and higher to download the latest version of Flash Player. Delete it if you don’t want users to see the prompt. -->
<param name="expressinstall" value="../Scripts/expressInstall.swf" />
<!-- Next object tag is for non-IE browsers. So hide it from IE using IECC. -->
<!--[if !IE]>-->
<object type="application/x-shockwave-flash" data="../preview.swf" width="960" height="33">
<!--<![endif]-->
<param name="quality" value="high" />
<param name="wmode" value="opaque" />
<param name="swfversion" value="9.0.45.0" />
<param name="expressinstall" value="../Scripts/expressInstall.swf" />
<!-- The browser displays the following alternative content for users with Flash Player 6.0 and older. -->
<div>
<h4>Content on this page requires a newer version of Adobe Flash Player.</h4>
<p><a href="http://www.adobe.com/go/getflashplayer"><img src="http://www.adobe.com/images/shared/download_buttons/get_flash_player.gif" alt="Get Adobe Flash player" width="112" height="33" /></a></p>
</div>
<!--[if !IE]>-->
</object>
<!--<![endif]-->
</object>
</div>
</div>
</div>
</div>
<a href="http://www.guimusolutions.com">Guimu Solutions</a> © 2010 |<script type="text/javascript">
swfobject.registerObject("FlashID");
swfobject.registerObject("FlashID2");
</script>
</body>
<!-- InstanceEnd --></html>
<?php
mysql_free_result($busqueda);
?>