Foros del Web » Programando para Internet » PHP »

codigo y después duda...

Estas en el tema de codigo y después duda... en el foro de PHP en Foros del Web. <html> <head> <meta http-equiv="Cache-Control" content="no-cache"> <meta HTTP-EQUIV="Expires" CONTENT="Tue, 01 Jan 1980 1:00:00 GMT"> <meta HTTP-EQUIV="Pragma" CONTENT="no-cache"> <title> LISTA DE CONTRATOS</title> <?php include("inc_classes.php"); ?> <script language=javascript> ...
  #1 (permalink)  
Antiguo 09/09/2003, 23:21
 
Fecha de Ingreso: agosto-2003
Ubicación: Cancun
Mensajes: 97
Antigüedad: 20 años, 8 meses
Puntos: 0
Mensaje codigo y después duda...

<html>
<head>
<meta http-equiv="Cache-Control" content="no-cache">
<meta HTTP-EQUIV="Expires" CONTENT="Tue, 01 Jan 1980 1:00:00 GMT">
<meta HTTP-EQUIV="Pragma" CONTENT="no-cache">
<title> LISTA DE CONTRATOS</title>

<?php
include("inc_classes.php");
?>
<script language=javascript>
function recibir(a, b)
{
document.forms.hoteles.zona.value = a;
document.forms.hoteles.tarifa.value = b;
ventana.close();
ventana = false;
}
var ventana = false;
function abrir()
{
var popup = "<html><head><title>CRITERIOS DE FILTRADO</title></head><body bgcolor=lavender>";
popup += "<form name=enviar action='javascript: ";
popup += "opener.recibir(enviar.a.value, enviar.b.value)' >";
popup += "<div align=center>";
popup += "<font face=arial size=1 color=#000080>ZONA &nbsp;";
popup += "<input type=text name=a size=5 maxlength=3 style='background: white;border:1px solid blue;color:red;font-weight:normal;font-size:8pt'>&nbsp;&nbsp;"
popup += "<font face=arial size=1 color=#000080>TIPO TARIFA &nbsp;";
popup += "<input type=text name=b size=5 maxlength=3 style='background: white;border:1px solid blue;color:red;font-weight:normal;font-size:8pt'>"
popup += "<hr>"
popup += "<input type=submit></form></body></html>";
popup += "</div>";
ventana = window.open('contratofilter.php','','width=500,hei ght=200,left=150,top=150');
ventana.document.writeln(popup);
ventana.document.close();
}
</script>
</head>

<body bgcolor="lavender">

<?php
$db = mysql_connect("localhost", "root", "crypt");
mysql_select_db("myeurodb");
?>

<form name=hoteles method="get">
<input type=hidden name=zona>
<input type=hidden name=tarifa>
<input type="submit" name="submit" value="submit">
</form>

<div align=center>
<table width=600 border=1>
<tr>
<td width=200>
<div align=center>
<input type="button" class="boton" name="submit" value=" A G R E G A R " OnClick="window.location='contrato.php'">
</div>
</td>
<td width=200>
<div align=center>
<input type="submit" class="boton" name="submit" value="&nbsp;&nbsp;&nbsp; B U S C A R &nbsp;&nbsp;" OnClick=abrir()>
</div>
</td>
<td width=200>
<div align=center>
<input type="button" class="boton" name="submit" value="&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; S A L I R &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;" OnClick="window.location='valusr.php'">
</div>
</td>
</tr>
</table>
<hr>
</div>

<?php
if(isset($_GET['zona'])):

if (!$_GET['zona'] == "")
{
$zona = $_GET['zona'];
}
else
{
$zona = "%";
}

if (!$_GET['tarifa'] == "")
{
$tarifa = $_GET['tarifa'];
}
else
{
$tarifa = "%";
}

$sSql = "select a.cveproveedor, b.nombrecomercial, a.cvetipotarifariohotel, c.descripcion from tarifariohotel a, proveedores b, tipotarifariohotel c " .
"where a.cveproveedor = b.cveproveedor and a.cvetipotarifariohotel = c.cvetipotarifariohotel and tipotarifario = 'C' and substring(a.cveproveedor,1,3) like '" .
$zona . "' and a.cvetipotarifariohotel like '" . $tarifa . "' order by a.cveproveedor";
echo "<div align=center>";
$rsSql = mysql_query($sSql,$db);
$rows = mysql_num_rows($rsSql);
$fields = mysql_num_fields($rsSql);

echo "<table border=1>";
echo "<tr bgcolor='#CCCCFF'>" .
"<th width=30><font face='arial' size=1 color = darkblue>CVE HOTEL</font></th> " .
"<th width=300><font face='arial' size=1 color = darkblue>NOMBRE HOTEL</font></th> " .
"<th width=30><font face='arial' size=1 color = darkblue>CVE TARIFA</font></th> " .
"<th width=300><font face='arial' size=1 color = darkblue>DESCRIPCION TARIFA</font></th> " .
"</tr>";

while ($arr = mysql_fetch_array($rsSql))
{
echo "<tr>";
echo "<td><font face='arial' size=1 color = blue>" . $arr['cveproveedor'] . "</font></td>";
echo "<td><font face='arial' size=1 color = blue>" . $arr['nombrecomercial'] . "</font></td>";
echo "<td><font face='arial' size=1 color = blue>" . $arr['cvetipotarifariohotel'] . "</font></td>";
echo "<td><font face='arial' size=1 color = blue>" . $arr['descripcion'] . "</font></td>";
}
echo "</table>";
echo "</div>";

mysql_free_result($rsSql);
mysql_close($db);

endif;
?>
</body>
</html>
  #2 (permalink)  
Antiguo 09/09/2003, 23:25
 
Fecha de Ingreso: agosto-2003
Ubicación: Cancun
Mensajes: 97
Antigüedad: 20 años, 8 meses
Puntos: 0
Pregunta yo mismo, ahora la duda ¿?

este código originalmente no muestra nada, la idea es que al oprimir el botón: 'BUSCAR' aparezca un popup en donde tengo dos inputs (que los tomo como criterios de busqueda) los cuales al introducir datos y oprimir el botón: 'Enviar busqueda' se copian a dos inputs (hidden) en el documento que llamó al popup, posterior existe botón 'Submit' que procesa la busqueda con los criterios ya establecidos.....

Lo que quiero hacer es no tener que usar el input: 'submit' para hacer el select usando los criterios de busqueda, sino que se realice la busqueda al cerrar el popup...

gracias
  #3 (permalink)  
Antiguo 10/09/2003, 00:19
Avatar de nuevo  
Fecha de Ingreso: mayo-2003
Ubicación: Spain
Mensajes: 2.009
Antigüedad: 20 años, 11 meses
Puntos: 2
oye, te importaria colorear el codigo, asi yo y los demas lo leeremos mejor, solo tienes que usar algo como el bbcode,

[ php] al principio

[ /php] al final

eso si, quita los espacios en blanco, yo los puse para que vieses como se escribe, esq si no, no sale...jeje, un saludo ;)

una cosa mas... intenta no poner ni el user ni pass ni la BD de mysql en tus preguntas.... ya que algun curioso mal-intencionado podria sacar probecho de tu inocencia.... pon XXXX

y sobre el problema.... has probado si funciona sin el popup... osea, yo cuando hago algo de tipo poput en que uso java mexclado con php, intento hacer 1º el php y dejarlo listo para luego meter el java... lo has probado sin eso....?
__________________
3w.valenciadjs.com
3w.laislatv.com

Última edición por nuevo; 10/09/2003 a las 00:23
  #4 (permalink)  
Antiguo 10/09/2003, 00:21
Avatar de davidMS  
Fecha de Ingreso: abril-2003
Ubicación: Chepe
Mensajes: 202
Antigüedad: 21 años
Puntos: 0
seria algo asi como un java que al cerrarse la ventana (onUnload="") en vie el form de la pagina de atras (submit=>this)... pero creo que eso seria del foro de java, pues es client-side no?
Atención: Estás leyendo un tema que no tiene actividad desde hace más de 6 MESES, te recomendamos abrir un Nuevo tema en lugar de responder al actual.
Respuesta




La zona horaria es GMT -6. Ahora son las 09:13.