Ver Mensaje Individual
  #6 (permalink)  
Antiguo 29/07/2004, 11:39
augusto_jaramil
 
Fecha de Ingreso: junio-2004
Ubicación: Ciudad de Panama
Mensajes: 551
Antigüedad: 19 años, 10 meses
Puntos: 8
Hola foro,

Quiero de antemano agradecer la colaboracion de Soniagrande por indicarme la forma como podria hacer lo que he venido consultando. Al fin lo pude hacer.

Adjunto los scripts:

consulta.php:

<html>
<head>
<script languaje="javascript">
function abrirVentana() {
var ur;
ur = "zona.php?zona="+document.principal.zona.value ;
var miPopup;
miPopup = window.opwn(ur,"","width=600,height=400,menubar=no ");
}
</script>
</head>
<body topmargin="0" leftmargin="0" onLoad="window.name='principal'>
<table><tr>
<form action="<? echo $PHP_SELF; ?>" method="get" name="principal"><tr>
<table>
<td>Zona</td>
<td><input type="text" name="zona" value="" onChange='abrirVentana()'></td>
<td><input type="text" name="desc_zona" value=""></td><tr>
<td>Responsable</td>
<td><input type="text" name="responsable" value=""></td>
<td><input type="text" name="nombre" value=""></td><tr>
</table>
</form>
</table>
</body>
</html>


script para la popup (zona.php)

<?php
include 'DB.php';
include 'configuracion/abrirbd1.php';
$zona = $_GET['zona'];
$sql = "SELECT zona.*, maestro.nombre FROM zonas, maestro WHERE zona MATCHES '$zona*' AND maestro.cedula = zonas.responsable";
$result = $db->Query($sql);
$mat_zon = $db->getAll($sql);
?>

<html>
<head>
<script languaje="javascript">
function seleccionarZona(indice) {
window.opener.document.principal.zona.value = document.getElementsByName("zona")[indice].value;
window.opener.document.principal.desc_zona.value = document.getElementsByName("desc_zona")[indice].value;
window.opener.document.principal.responsable.value = document.getElementsByName("responsable")[indice].value;
window.opener.document.principal.nombre.value = document.getElementsByName("nombre")[indice].value;
window.close();
}
</script>
</head>
<body>
<form name="form1" action="consulta.php" target="principal" method="get">
<table border="1><tr>
<td></td><td>Zona</td><td>Nombre</td><tr>
<?php $i = 0;
while($result->fetchInto($row)) {
$i++;
$j = $i - 1; ?>
<td><input type="radio" name="seleccionar" onClick="seleccionarZona(<? echo $j; ?>)">
<input type="hidden" id="zona<? echo $i; ?>" name="zona" value="<? echo trim($row['zona']); ?>">
<input type="hidden" id="desc_zona<? echo $i; ?>" name="desc_zona" value="<? echo trim($row['desc_zona']); ?>">
<input type="hidden" id="responsable<? echo $i; ?>" name="responsable" value="<? echo trim($row['responsable']); ?>">
<input type="hidden" id="nombre<? echo $i; ?>" name="nombre" value="<? echo trim($row['nombre']); ?>"></td>
<td><? echo trim($row['zona']); ?></td>
<td><? echo trim($row['desc_zona']); ?></td><tr>
<? } ?>
</table>
</form>
</body>
</html>

Cordial saludo. Y por aqui volvere.