Ver Mensaje Individual
  #9 (permalink)  
Antiguo 22/10/2013, 08:44
nksn
 
Fecha de Ingreso: mayo-2009
Ubicación: Japon
Mensajes: 60
Antigüedad: 15 años
Puntos: 12
Respuesta: Capturar dato

pues la verdad no se que esta sucediendo pero reescribo todo

Código PHP:

<script type="text/javascript">

function suma() 
{
    valor1 = document.getElementById("A").value;
    valor2 = document.getElementById("B").value;
    valor3 = document.getElementById("C").value;
    total = parseFloat(valor1) + parseFloat(valor2) + parseFloat(valor3);
    document.getElementById("total").value= total;
}

</script>


</head>

<body>
    <form action="resultsuma.php" method="post">
        <input type="text" value="" name="var1" id="A" onchange="suma();" /> 
        <input type="text" value="" name="var2" id="B" onchange="suma();" />
        <input type="text" value="" name="var3" id="C" onchange="suma();" /> 
        <input type="text" value="" name="form" id="total" value="0" disabled /> /* en nombre de la variable es form */
        <input type="submit" value="Guardar">
    </form>
</body> 
</html>

<?php 

$variable1 
$_POST['var1'];

echo 
$variable1;
$variable2 $_POST['var2'];

echo 
$variable2
$variable3 $_POST['var3'];

echo 
$variable3;
$resultado $_POST['form'];  /* en nombre de la variable aquí también */

echo $resultado;