Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

879
Visualizações
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 Respostas
Responde à pergunta

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 Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda