Ver Mensaje Individual
  #33 (permalink)  
Antiguo 01/10/2008, 11:38
jcouoh
 
Fecha de Ingreso: septiembre-2003
Ubicación: Merida, yucatan
Mensajes: 282
Antigüedad: 21 años, 6 meses
Puntos: 1
Respuesta: No me funciona pasar valores entre ventanas

Lo he hecho de esta manera; son tres archivos
1.- prev.php
Código PHP:

<html><head></head><body>


<
form name="frm" id="frm" action="post.php">

<
table width="80"><tr><td>
<
div id="bloque" style="float:left; width:80px; ">
<
input type=text name="GtoFecha" id="GtoFecha" value="">

</
div>
</
td></tr>
<
input type=submit>
</
table>

</
form>



<
a href="#" title="" onClick="window.open('gastos.php')" width="400" height="200">Gastos</a>



</
body></html
2.- gastos.php

Código PHP:
<html>
<head>
<title></title>
<style type="text/css">
.input1
{
BORDER-RIGHT: #336699 1px solid;
BORDER-TOP: #336699 1px solid;
FONT-SIZE: 12px;
BORDER-LEFT: #336699 1px solid;
WIDTH: 80;
COLOR: #000000;
BORDER-BOTTOM: #336699 1px solid;
FONT-FAMILY: Arial, Helvetica, sans-serif;
BACKGROUND-COLOR: #ffffff
}

</style>



</head>
<body>


<table width=2000> <tr><td width=110 height=50>

<table>
<tr><td class="td" align=right>Fecha:</td></tr>


</table></td><td>
<form id="myform" name="myform" action="<?php echo $_SERVER['PHP_SELF'?>" method="post">

<div id="bloque" style="float:left; width:80px; ">
<table width="80"><tr><td>

<input type=text class=input1
name="GtoFecha" id="GtoFecha"
value="">

</td></tr>

</table>
</div>


</form>

</td></tr></table>
<form><div style="clear:both; padding-top:15px"><button type="button" onClick="doIt()">Gasto Nuevo</button>
    <br>
    <br>

</div></form>
<script>
function doIt()
{
var f = document.getElementById('myform');
var b = document.getElementById('bloque');
var b2=b.cloneNode(true);
f.appendChild(b2);

var g = opener.document.getElementById('frm');
var h = opener.document.getElementById('bloque');

var g2=h.cloneNode(true);
h.appendChild(g2);

}

</script>

<?php

/*
if(isset($_POST) && !empty($_POST)){
echo '<pre>';
print_r($_POST);
echo '<pre>';
}

*/
?>


<a href="JavaScript:close();" title="pasar valor" onClick="regreso()">Regresar a la Ventana Principal</a>


<script>



function regreso()

{
var indice;
var ind;
indice=document.myform.GtoFecha.length;


for (ind = 0; ind<indice; ind++)

{
window.opener.document.frm.GtoFecha[ind].value = 
window.document.myform.GtoFecha[ind].value;


}



}



</script>

</body>
</html>
y el archivo post.php

Código PHP:

<?

foreach ($_POST as $key => $value) { 
echo 
$key;
echo 
$value;
}

?>
Cuando envio el archivo no me da ningun resultado, no se donde estoy mal