Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

868
Views
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 answers
Answer question

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 Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!