Ver Mensaje Individual
  #2 (permalink)  
Antiguo 07/06/2011, 04:47
guillegf84
 
Fecha de Ingreso: julio-2008
Mensajes: 38
Antigüedad: 15 años, 9 meses
Puntos: 0
Respuesta: Almacenar valor en variables php desde js

Gracias, ya lo he conseguido, no sé si es del todo correcto pero funciona!

Código PHP:
Ver original
  1. <html>
  2. <head>
  3. <script type="text/javascript">
  4. function confirmar_resultado()
  5. {
  6. var r=confirm("¿ACEPTAS?");
  7. var resultado="";
  8. if (r==true)
  9.   {
  10.         resultado="si";
  11.         return resultado;
  12.   }
  13. else
  14.   {
  15.         resultado="no";  
  16.         return resultado;
  17.   }
  18. }
  19. </script>
  20. </head>
  21. <body>
  22.  
  23. <?php
  24. $llamada="<script type='text/javascript'>document.write(confirmar_resultado());</script>";
  25. $aux = $llamada;
  26. echo $aux;
  27. ?>
  28. </body>
  29. </html>