Foros del Web » Programando para Internet » PHP »

[SOLUCIONADO] PHP no recibe variable

Estas en el tema de PHP no recibe variable en el foro de PHP en Foros del Web. Hola, tengo un problema al recibir una variable enviada a php por post, no se si el dato no se esta recibiendo bien o solamente ...
  #1 (permalink)  
Antiguo 11/02/2015, 12:51
 
Fecha de Ingreso: enero-2015
Ubicación: Valparaiso
Mensajes: 88
Antigüedad: 9 años, 3 meses
Puntos: 0
PHP no recibe variable

Hola, tengo un problema al recibir una variable enviada a php por post, no se si el dato no se esta recibiendo bien o solamente no se muestra correctamente, lo extraño es que al enviarlo por get tampoco es recibida pero el dato sí se envía por url. Me llama la atencion este problema ya que jamas me había pasado.
Código HTML:
Ver original
  1. <!DOCTYPE html PUBLIC
  2.          "-//W3C//DTD XHTML 1.0 Transitional//EN"
  3.          "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
  4.   <head>
  5.     <title>Dynarch Calendar -- Populate fields</title>
  6.     <script src="../src/js/jscal2.js"></script>
  7.     <script src="../src/js/lang/en.js"></script>
  8.     <link rel="stylesheet" type="text/css" href="../src/css/jscal2.css" />
  9.     <link rel="stylesheet" type="text/css" href="../src/css/border-radius.css" />
  10.     <link rel="stylesheet" type="text/css" href="../src/css/steel/steel.css" />
  11.   </head>
  12.   <body>
  13.     <form action="4_process.php" method="POST">
  14.       <table>
  15.         <tr>
  16.           <td colspan="4" id="cont"></td>
  17.         </tr>
  18.         <tr>
  19.             <input style="text-align: center" readonly="true" name="date" id="f_date" size="14" />
  20.         </tr>
  21.       </table>
  22.       <input type="submit" value="Enviar"/>
  23.     </form>
  24.     <script type="text/javascript">
  25.  
  26.       function updateFields(cal) {
  27.               var date = cal.selection.get();
  28.               if (date) {
  29.                       date = Calendar.intToDate(date);
  30.                       document.getElementById("f_date").value = Calendar.printDate(date, "%Y-%m-%d");
  31.               }
  32.       };
  33.  
  34.       Calendar.setup({
  35.               cont         : "cont",
  36.               onSelect     : updateFields
  37.       });
  38.  
  39.     </script>
  40.   </body>
  41. </html>

Código PHP:
Ver original
  1. <html>
  2. <?php
  3. $fecha = $_POST["date"];
  4. ?>
  5.     <body>
  6.     Bienvenido
  7.     <?php echo $fecha; ?>
  8.     </body>
  9. </html>
  #2 (permalink)  
Antiguo 11/02/2015, 13:31
Avatar de hhs
hhs
Colaborador
 
Fecha de Ingreso: junio-2013
Ubicación: México
Mensajes: 2.995
Antigüedad: 10 años, 9 meses
Puntos: 379
Respuesta: PHP no recibe variable

hmm que raro, prueba haciendo un var_dump y publica lo que te envia
Código PHP:
Ver original
  1. var_dump($_POST);
__________________
Saludos
About me
Laraveles
A class should have only one reason to change.
  #3 (permalink)  
Antiguo 11/02/2015, 13:41
 
Fecha de Ingreso: enero-2015
Ubicación: Valparaiso
Mensajes: 88
Antigüedad: 9 años, 3 meses
Puntos: 0
Respuesta: PHP no recibe variable

Cita:
Iniciado por hhs Ver Mensaje
hmm que raro, prueba haciendo un var_dump y publica lo que te envia
Código PHP:
Ver original
  1. var_dump($_POST);
error feo mio... estaba cargando el html directamente, no desde localhost. Pido disculpas por las molestias

Etiquetas: fecha, html, select, variable
Atención: Estás leyendo un tema que no tiene actividad desde hace más de 6 MESES, te recomendamos abrir un Nuevo tema en lugar de responder al actual.
Respuesta




La zona horaria es GMT -6. Ahora son las 13:44.