Ver Mensaje Individual
  #1 (permalink)  
Antiguo 26/02/2013, 18:53
julslash
 
Fecha de Ingreso: febrero-2010
Ubicación: valencia
Mensajes: 146
Antigüedad: 14 años, 3 meses
Puntos: 3
calcular operaciones con un valor cargado a un pop up desde un input

hola tengo este codigo q hice mi proplema es el siguiente!

paso un valor de un input y lo capturo en otra pagina con javascript
ese valor lo paso a una variable php para luego hacer operaciones matematicas con ese valor
y el problema es q cuando a ese valor le hago cualquier operacion por ejemplo sumarle 1 o cualquier numero no lo hace!


pagina incial formulario.php


Código PHP:
    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
    "http://www.w3.org/TR/html4/loose.dtd"
>
    <
html xmlns="http://www.w3.org/1999/xhtml">
        <
head>
            <
meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
            <
title>SITE</title>
            
<
SCRIPT LANGUAGE="JavaScript">
    <!--
        function 
newWindow(url) { 
    var 
x,y;
    
screen.width-35;
    
screen.height-30;
    var 
win window.open(url,'glossaryWindow','toolbar=no,directories=no,width=500,height=500'+
    
'screenX=0,screenY=0,top=0,left=0,location=no,status=no,scrollbars=no,resize=yes,menubar=no');

    
//-->
    
</SCRIPT>
  </HEAD>
  <BODY>
    <INPUT TYPE="text" NAME="txtData" ID="txtData">
    <INPUT TYPE="button" value="enviar" onclick="Javascript: newWindow('emergente.php');" >
  </BODY>
    </html> 


pagina pop up emergente.php


Código PHP:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml">
        <head>
            <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
            <title>SITE</title>
            
            
 <SCRIPT LANGUAGE="JavaScript">
var variablejs = window.opener.document.getElementById('txtData').value;

</SCRIPT>
     
            
        </head>
        <body>
        
    
<?php
$variablephp 
"<script> document.write(variablejs) </script>";

$cont$variablephp;

echo 
$cont;



?>


        </body>
    </html>


el codigo hace lo que necesito q es sacar un valor de un input de una pagina y pasarlo al pop up

pero si yo escribo esto en emergente,php no funciona

si por ejemplo ingrese 8 al entrar al codigo a continuacion deberia mostrar 9 porq estoy sumando 1 pero no lo hace y me muestra 1

<?php
$variablephp = "<script> document.write(variablejs) </script>";

$cont= $variablephp;
$suma=$cont+1;
echo $suma;

?>

alli no me toma el valor y me muestra un 1
por que ocurre eso?

alguien me puede ayudar?