Ver Mensaje Individual
  #1 (permalink)  
Antiguo 22/03/2011, 20:56
jonathan777
 
Fecha de Ingreso: marzo-2011
Ubicación: lima
Mensajes: 25
Antigüedad: 13 años, 1 mes
Puntos: 0
Exclamación Envio de datos desde javascript hacia php

Hola tengo un pequeño inconveniente con mi aplicacion la eh trabajado en javascript pero necesito una idea de como hacer persistir sus datos con php.

Código PHP:
Ver original
  1. <html>
  2.     <head>
  3.         <script type="text/javascript">
  4.             function Mostrar()
  5.             {
  6.                 var objeto=document.getElementById("mySelect");
  7.                 var option=document.createElement("option");
  8.                 var MiVariable=prompt("Ingresa Direccion")
  9.                 option.text=MiVariable;
  10.                 try
  11.                 {
  12.                     // for IE earlier than version 8
  13.                     objeto.add(option,objeto.options[null]);
  14.                 }
  15.                 catch (e)
  16.                 {
  17.                     objeto.add(option,null);
  18.                 }
  19.             }
  20.         </script>
  21.     </head>
  22.     <body>
  23.  
  24.         <form id="form9" name="form9">
  25.             <select id="mySelect" size="5" onchange="document.getElementById('form9').submit();">
  26.             </select>
  27.         </form>
  28.  
  29.         <button type="button" onclick="Mostrar()">Insertar direccion</button>
  30.  
  31.     </body>
  32. </html>
La idea es darle al boton y teclear algo pero como veran hay un onchange con el cual pretendo pasar el valor seleccionado a una variable php por medio de post pero el hecho es que cuando eligo un valor se recarga y borra los valores agregados.
Quisiera saber si existe alguna forma de guardar estos datos en una variable php,una cokie,etc.
Recibo cualkier sugerencia.
Gracias.