Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

871
Vistas
Waning: Undefined array key when trying to store post variables (xmlhttprequest)

I'm trying to save the data that "buchen.php" get in php variables but I keep getting the following error

Warning: Undefined array key "reise_id" in buchen.php on line 4

Warning: Undefined array key "platz_geb" in buchen.php on line 5

Can anyone tell what could be wrong here?

    var xhr = new XMLHttpRequest();
    xhr.open('POST', 'buchen.php');
    xhr.setRequestHeader('Content-Type', 'application/json');
    xhr.send(JSON.stringify({
        reise_id: "<?php echo $reise_id; ?>",
        platz_geb: platz_blau
    }));
//buchen.php

    $reise_id = $_POST['reise_id'];
    $platz_geb = $_POST['platz_geb'];
about 4 years ago · Juan Pablo Isaza
1 Respuestas
Responde la pregunta

0

Instead of grabbing the POST variables as always, try the following on the PHP code:

$json = file_get_contents('php://input');
echo $json;
about 4 years ago · Juan Pablo Isaza Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda